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

Unified Diff: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc

Issue 2496783002: gpu: Reuse existing code for shared memory allocation. (Closed)
Patch Set: nacl 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: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
diff --git a/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc b/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
index 2641b8bfa1635e262214f998f685d376ddcc5bc0..46fd6466a320cbee409ed66502f3f94bed52cc4d 100644
--- a/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
+++ b/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
@@ -78,7 +78,10 @@ GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
handle.offset = 0;
handle.stride = static_cast<int32_t>(
gfx::RowSizeForBufferFormat(size.width(), format, 0));
- shared_memory.GiveToProcess(child_process, &handle.handle);
+ if (child_process == base::kNullProcessHandle)
+ handle.handle = shared_memory.TakeHandle();
+ else
+ shared_memory.GiveToProcess(child_process, &handle.handle);
return handle;
}

Powered by Google App Engine
This is Rietveld 408576698