Chromium Code Reviews| Index: content/common/gpu/client/gpu_channel_host.cc |
| diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc |
| index b4460bbb56e3d1e999349bca9e972f756bc3612b..918872401900b266f8fe50ca846f079d1e957007 100644 |
| --- a/content/common/gpu/client/gpu_channel_host.cc |
| +++ b/content/common/gpu/client/gpu_channel_host.cc |
| @@ -18,7 +18,7 @@ |
| #include "ipc/ipc_sync_message_filter.h" |
| #include "url/gurl.h" |
| -#if defined(OS_WIN) |
| +#if defined(OS_WIN) || defined(OS_MACOSX) |
| #include "content/public/common/sandbox_init.h" |
| #endif |
| @@ -303,7 +303,7 @@ base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess( |
| if (IsLost()) |
| return base::SharedMemory::NULLHandle(); |
| -#if defined(OS_WIN) |
| +#if defined(OS_WIN) || defined(OS_MACOSX) |
| // Windows needs to explicitly duplicate the handle out to another process. |
| base::SharedMemoryHandle target_handle; |
| base::ProcessId peer_pid; |
| @@ -313,22 +313,15 @@ base::SharedMemoryHandle GpuChannelHost::ShareToGpuProcess( |
| return base::SharedMemory::NULLHandle(); |
| peer_pid = channel_->GetPeerPID(); |
| } |
| - if (!BrokerDuplicateHandle(source_handle, |
| - peer_pid, |
| - &target_handle, |
| - FILE_GENERIC_READ | FILE_GENERIC_WRITE, |
| - 0)) { |
| + bool success = BrokerDuplicateSharedMemoryHandle(source_handle, peer_pid, |
| + &target_handle); |
| + if (!success) |
| return base::SharedMemory::NULLHandle(); |
| - } |
| return target_handle; |
| #else |
| - int duped_handle = HANDLE_EINTR(dup(source_handle.fd)); |
| - if (duped_handle < 0) |
| - return base::SharedMemory::NULLHandle(); |
| - |
| - return base::FileDescriptor(duped_handle, true); |
| -#endif |
| + return base::SharedMemory::Duplicatehandle(source_handle); |
|
jbauman
2015/06/03 22:01:41
incorrect capitalization of DuplicateHandle.
erikchen
2015/06/03 22:03:01
Done.
|
| +#endif // defined(OS_WIN) || defined(OS_MACOSX) |
| } |
| int32 GpuChannelHost::ReserveTransferBufferId() { |