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

Unified Diff: content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc

Issue 1166443004: Further clean up pepper's use of SharedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Fix compile error on windows. 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
Index: content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc
diff --git a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc
index aa0cac403b1bffa742bc32cd6d7584ce67b2caf1..7a5a0c160927c882687bc154b4571c711739ba99 100644
--- a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc
@@ -7,6 +7,10 @@
#include "content/child/child_process.h"
#include "content/common/sandbox_util.h"
+#if defined(OS_WIN) || defined(OS_MACOSX)
+#include "content/public/common/sandbox_init.h"
+#endif // defined(OS_WIN) || defined(OS_MACOSX)
+
namespace content {
PepperProxyChannelDelegateImpl::~PepperProxyChannelDelegateImpl() {}
@@ -35,15 +39,16 @@ base::SharedMemoryHandle
PepperProxyChannelDelegateImpl::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;
+#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:
+ bool success =
+ BrokerDuplicateSharedMemoryHandle(handle, remote_pid, &duped_handle);
+ if (success)
+ return duped_handle;
+ return base::SharedMemory::NULLHandle();
#else
-#error Not implemented.
-#endif
- return ShareHandleWithRemote(local_platform_file, remote_pid, false);
+ return base::SharedMemory::DuplicateHandle(handle);
+#endif // defined(OS_WIN) || defined(OS_MACOSX)
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698