Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: content/common/child_process_host_impl.cc

Issue 2496783002: gpu: Reuse existing code for shared memory allocation. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 42f368d0ed1272b3ac7b67c529fbc6e19ab07e12..529cc77b64b0dc9f1a30bb00c3dfa9911769249a 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -192,7 +192,7 @@ bool ChildProcessHostImpl::Send(IPC::Message* message) {
}
void ChildProcessHostImpl::AllocateSharedMemory(
- size_t buffer_size, base::ProcessHandle child_process_handle,
+ size_t buffer_size,
base::SharedMemoryHandle* shared_memory_handle) {
base::SharedMemory shared_buf;
if (!shared_buf.CreateAnonymous(buffer_size)) {
@@ -200,7 +200,7 @@ void ChildProcessHostImpl::AllocateSharedMemory(
NOTREACHED() << "Cannot create shared memory buffer";
return;
}
- shared_buf.GiveToProcess(child_process_handle, shared_memory_handle);
+ *shared_memory_handle = shared_buf.TakeHandle();
}
int ChildProcessHostImpl::GenerateChildProcessUniqueId() {
@@ -316,7 +316,7 @@ void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) {
void ChildProcessHostImpl::OnAllocateSharedMemory(
uint32_t buffer_size,
base::SharedMemoryHandle* handle) {
- AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle);
+ AllocateSharedMemory(buffer_size, handle);
}
void ChildProcessHostImpl::OnShutdownRequest() {
@@ -338,7 +338,7 @@ void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer(
// sure |usage| is supported here.
if (gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) {
*handle = gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
- id, gfx::Size(width, height), format, peer_process_.Handle());
+ id, gfx::Size(width, height), format);
}
}

Powered by Google App Engine
This is Rietveld 408576698