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

Unified Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 1152273005: Prepare gpu_channel_host for SharedMemoryHandles not backed by POSIX fds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698