Convert Pepper shared memory allocation to the new shared memory API
This CL replaces the deprecated base::SharedMemoryHandle and
base::SharedMemory in Pepper to allocate shared memory for plugin process
with the new shared memory API
The shared memory is used in ppapi::ArrayBufferVar in the following way:
A plugin process asks its host (renderer) to allocate shared memory.
The plugin process writes into this memory, and the host only reads from it.
The host tracks all shared memory it allocates in a table via HostVarTracker::TrackSharedMemoryHandle().
A shared memory handle can be later extracted from this table by calling
Even though the host never reads from the shared memory, ReadOnlySharedMemoryRegion
cannot be used because the plugin should keep its writable shared memory region
to be used in ArrayBufferRawVarData::Init() later. The new shared memory API
doesn't allow to have read-only and writable handles to the same region at the same time.
Moreover, this region is stored inside in ppapi::proxy::ArrayBufferRawVarData::plugin_shm_handle_
as a ppapi::proxy::SerializedHandle that doesn't support WritableSharedMemoryRegion, and adding
this support would be cumbersome.
Notice that the shared memory used here was never actually read-only, because it wasn't
constructed from a handle obtained from base::SharedMemory::GetReadOnlyHandle().
See a comment to the base::SharedMemory constructor.
Commit-Queue: Tanmoy Mollik <email@example.com>
Reviewed-by: Alex Ilin <firstname.lastname@example.org>
Reviewed-by: Bill Budge <email@example.com>
9 files changed