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; |
} |