Index: content/ppapi_plugin/ppapi_thread.cc |
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc |
index a0ed633ff8747a0d22124f6b3af70eadda77e936..10c82631b5c5dc020bb3a3e7f144a5203a940547 100644 |
--- a/content/ppapi_plugin/ppapi_thread.cc |
+++ b/content/ppapi_plugin/ppapi_thread.cc |
@@ -202,16 +202,24 @@ IPC::PlatformFileForTransit PpapiThread::ShareHandleWithRemote( |
base::SharedMemoryHandle PpapiThread::ShareSharedMemoryHandleWithRemote( |
const base::SharedMemoryHandle& handle, |
base::ProcessId remote_pid) { |
- base::PlatformFile local_platform_file = |
-#if defined(OS_POSIX) |
- handle.fd; |
-#elif defined(OS_WIN) |
- handle; |
-#else |
-#error Not implemented. |
+#if defined(OS_WIN) |
+ if (peer_handle_.IsValid()) { |
+ DCHECK(is_broker_); |
+ return IPC::GetFileHandleForProcess(handle, peer_handle_.Get(), false); |
+ } |
#endif |
- return PpapiThread::ShareHandleWithRemote(local_platform_file, remote_pid, |
- false); |
+ |
+ DCHECK(remote_pid != base::kNullProcessId); |
+#if defined(OS_WIN) || defined(OS_MACOSX) |
+ base::SharedMemoryHandle duped_handle; |
piman
2015/06/03 17:44:44
nit: just initialize this with base::SharedMemory:
erikchen
2015/06/03 17:58:31
Your suggestion saves 3 lines of code, but it make
|
+ bool success = |
+ BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle); |
+ if (success) |
+ return duped_handle; |
+ return base::SharedMemory::NULLHandle(); |
+#else |
+ return base::SharedMemory::DuplicateHandle(handle); |
+#endif // defined(OS_WIN) || defined(OS_MACOSX) |
} |
std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { |