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

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

Issue 9958034: Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « content/browser/renderer_host/gpu_message_filter.cc ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/command_buffer_proxy_impl.cc
===================================================================
--- content/common/gpu/client/command_buffer_proxy_impl.cc (revision 132263)
+++ content/common/gpu/client/command_buffer_proxy_impl.cc (working copy)
@@ -20,6 +20,10 @@
#include "gpu/command_buffer/common/command_buffer_shared.h"
#include "ui/gfx/size.h"
+#if defined(OS_WIN)
+#include "content/common/sandbox_policy.h"
+#endif
+
using gpu::Buffer;
CommandBufferProxyImpl::CommandBufferProxyImpl(
@@ -234,7 +238,13 @@
return -1;
base::SharedMemoryHandle handle = shm->handle();
-#if defined(OS_POSIX)
+#if defined(OS_WIN)
+ // Windows needs to explicitly duplicate the handle out to another process.
+ if (!sandbox::BrokerDuplicateHandle(handle, channel_->gpu_pid(),
+ &handle, FILE_MAP_WRITE, 0)) {
+ return -1;
+ }
+#elif defined(OS_POSIX)
DCHECK(!handle.auto_close);
#endif
@@ -257,10 +267,20 @@
if (last_state_.error != gpu::error::kNoError)
return -1;
+ // Returns FileDescriptor with auto_close off.
+ base::SharedMemoryHandle handle = shared_memory->handle();
+#if defined(OS_WIN)
+ // Windows needs to explicitly duplicate the handle out to another process.
+ if (!sandbox::BrokerDuplicateHandle(handle, channel_->gpu_pid(),
+ &handle, FILE_MAP_WRITE, 0)) {
+ return -1;
+ }
+#endif
+
int32 id;
if (!Send(new GpuCommandBufferMsg_RegisterTransferBuffer(
route_id_,
- shared_memory->handle(), // Returns FileDescriptor with auto_close off.
+ handle,
size,
id_request,
&id))) {
« no previous file with comments | « content/browser/renderer_host/gpu_message_filter.cc ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698