Pepper: remove the SHARED_MEMORY SerializedHandle type.
With the migration of the rest of PPAPI away from the legacy shared
memory API, the SHARED_MEMORY kind of SerializedHandle is no longer
needed and is removed.
Bug: 795291
Change-Id: I547b3b88825da0311ea4b684150d049a1f52768d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724512
Reviewed-by: Bill Budge <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Derek Schuff <[email protected]>
Commit-Queue: Matthew Cary (CET) <[email protected]>
Cr-Commit-Position: refs/heads/master@{#685022}
diff --git a/ppapi/proxy/serialized_handle.cc b/ppapi/proxy/serialized_handle.cc
index ee06d0a..1321651c 100644
--- a/ppapi/proxy/serialized_handle.cc
+++ b/ppapi/proxy/serialized_handle.cc
@@ -5,7 +5,6 @@
#include "ppapi/proxy/serialized_handle.h"
#include "base/files/file.h"
-#include "base/memory/shared_memory.h"
#include "base/pickle.h"
#include "build/build_config.h"
#include "ipc/ipc_platform_file.h"
@@ -19,7 +18,6 @@
SerializedHandle::SerializedHandle()
: type_(INVALID),
- size_(0),
descriptor_(IPC::InvalidPlatformFileForTransit()),
open_flags_(0),
file_io_(0) {
@@ -27,8 +25,6 @@
SerializedHandle::SerializedHandle(SerializedHandle&& other)
: type_(other.type_),
- shm_handle_(other.shm_handle_),
- size_(other.size_),
shm_region_(std::move(other.shm_region_)),
descriptor_(other.descriptor_),
open_flags_(other.open_flags_),
@@ -39,8 +35,6 @@
SerializedHandle& SerializedHandle::operator=(SerializedHandle&& other) {
Close();
type_ = other.type_;
- shm_handle_ = other.shm_handle_;
- size_ = other.size_;
shm_region_ = std::move(other.shm_region_);
descriptor_ = other.descriptor_;
open_flags_ = other.open_flags_;
@@ -51,21 +45,11 @@
SerializedHandle::SerializedHandle(Type type_param)
: type_(type_param),
- size_(0),
descriptor_(IPC::InvalidPlatformFileForTransit()),
open_flags_(0),
file_io_(0) {
}
-SerializedHandle::SerializedHandle(const base::SharedMemoryHandle& handle,
- uint32_t size)
- : type_(SHARED_MEMORY),
- shm_handle_(handle),
- size_(size),
- descriptor_(IPC::InvalidPlatformFileForTransit()),
- open_flags_(0),
- file_io_(0) {}
-
SerializedHandle::SerializedHandle(base::ReadOnlySharedMemoryRegion region)
: SerializedHandle(
base::ReadOnlySharedMemoryRegion::TakeHandleForSerialization(
@@ -79,7 +63,6 @@
SerializedHandle::SerializedHandle(
base::subtle::PlatformSharedMemoryRegion region)
: type_(SHARED_MEMORY_REGION),
- size_(0),
shm_region_(std::move(region)),
descriptor_(IPC::InvalidPlatformFileForTransit()),
open_flags_(0),
@@ -93,7 +76,6 @@
Type type,
const IPC::PlatformFileForTransit& socket_descriptor)
: type_(type),
- size_(0),
descriptor_(socket_descriptor),
open_flags_(0),
file_io_(0) {
@@ -101,8 +83,6 @@
bool SerializedHandle::IsHandleValid() const {
switch (type_) {
- case SHARED_MEMORY:
- return base::SharedMemory::IsHandleValid(shm_handle_);
case SHARED_MEMORY_REGION:
return shm_region_.IsValid();
case SOCKET:
@@ -121,9 +101,6 @@
case INVALID:
NOTREACHED();
break;
- case SHARED_MEMORY:
- base::SharedMemory::CloseHandle(shm_handle_);
- break;
case SHARED_MEMORY_REGION:
shm_region_ = base::subtle::PlatformSharedMemoryRegion();
break;
@@ -140,9 +117,7 @@
// static
void SerializedHandle::WriteHeader(const Header& hdr, base::Pickle* pickle) {
pickle->WriteInt(hdr.type);
- if (hdr.type == SHARED_MEMORY) {
- pickle->WriteUInt32(hdr.size);
- } else if (hdr.type == FILE) {
+ if (hdr.type == FILE) {
pickle->WriteInt(hdr.open_flags);
pickle->WriteInt(hdr.file_io);
}
@@ -150,20 +125,12 @@
// static
bool SerializedHandle::ReadHeader(base::PickleIterator* iter, Header* hdr) {
- *hdr = Header(INVALID, 0, 0, 0);
+ *hdr = Header(INVALID, 0, 0);
int type = 0;
if (!iter->ReadInt(&type))
return false;
bool valid_type = false;
switch (type) {
- case SHARED_MEMORY: {
- uint32_t size = 0;
- if (!iter->ReadUInt32(&size))
- return false;
- hdr->size = size;
- valid_type = true;
- break;
- }
case FILE: {
int open_flags = 0;
PP_Resource file_io = 0;