| Index: content/common/child_process_host_impl.cc
|
| diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
|
| index 59325c330ddfeece1e2a14bdcd3a87c708736a7a..71a34fcc6d9e244060725270f20ecda6b6fa252a 100644
|
| --- a/content/common/child_process_host_impl.cc
|
| +++ b/content/common/child_process_host_impl.cc
|
| @@ -185,6 +185,18 @@
|
| return channel_->Send(message);
|
| }
|
|
|
| +void ChildProcessHostImpl::AllocateSharedMemory(
|
| + size_t buffer_size, base::ProcessHandle child_process_handle,
|
| + base::SharedMemoryHandle* shared_memory_handle) {
|
| + base::SharedMemory shared_buf;
|
| + if (!shared_buf.CreateAnonymous(buffer_size)) {
|
| + *shared_memory_handle = base::SharedMemory::NULLHandle();
|
| + NOTREACHED() << "Cannot create shared memory buffer";
|
| + return;
|
| + }
|
| + shared_buf.GiveToProcess(child_process_handle, shared_memory_handle);
|
| +}
|
| +
|
| int ChildProcessHostImpl::GenerateChildProcessUniqueId() {
|
| // This function must be threadsafe.
|
| //
|
| @@ -243,9 +255,12 @@
|
| IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg)
|
| IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
|
| OnShutdownRequest)
|
| - // NB: The SyncAllocateGpuMemoryBuffer and DeletedGpuMemoryBuffer IPCs are
|
| - // handled here for non-renderer child processes. For renderer processes,
|
| - // they are handled in RenderMessageFilter.
|
| + // NB: The SyncAllocateSharedMemory, SyncAllocateGpuMemoryBuffer, and
|
| + // DeletedGpuMemoryBuffer IPCs are handled here for non-renderer child
|
| + // processes. For renderer processes, they are handled in
|
| + // RenderMessageFilter.
|
| + IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory,
|
| + OnAllocateSharedMemory)
|
| IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
|
| OnAllocateGpuMemoryBuffer)
|
| IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
|
| @@ -290,6 +305,12 @@
|
|
|
| void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
|
| delegate_->OnBadMessageReceived(message);
|
| +}
|
| +
|
| +void ChildProcessHostImpl::OnAllocateSharedMemory(
|
| + uint32_t buffer_size,
|
| + base::SharedMemoryHandle* handle) {
|
| + AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle);
|
| }
|
|
|
| void ChildProcessHostImpl::OnShutdownRequest() {
|
|
|