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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.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/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
===================================================================
--- content/common/gpu/gpu_command_buffer_stub.cc (revision 132263)
+++ content/common/gpu/gpu_command_buffer_stub.cc (working copy)
@@ -23,6 +23,10 @@
#include "ui/gfx/gl/gl_bindings.h"
#include "ui/gfx/gl/gl_switches.h"
+#if defined(OS_WIN)
+#include "content/common/sandbox_policy.h"
+#endif
+
GpuCommandBufferStub::SurfaceState::SurfaceState(int32 surface_id,
bool visible,
base::TimeTicks last_used_time)
@@ -467,17 +471,7 @@
size_t size,
int32 id_request,
IPC::Message* reply_message) {
-#if defined(OS_WIN)
- // Windows dups the shared memory handle it receives into the current process
- // and closes it when this variable goes out of scope.
- base::SharedMemory shared_memory(transfer_buffer,
- false,
- channel_->renderer_process());
-#else
- // POSIX receives a dup of the shared memory handle and closes the dup when
- // this variable goes out of scope.
base::SharedMemory shared_memory(transfer_buffer, false);
-#endif
if (command_buffer_.get()) {
int32 id = command_buffer_->RegisterTransferBuffer(&shared_memory,
@@ -506,20 +500,22 @@
void GpuCommandBufferStub::OnGetTransferBuffer(
int32 id,
IPC::Message* reply_message) {
- // Fail if the renderer process has not provided its process handle.
- if (!channel_->renderer_process())
- return;
-
if (command_buffer_.get()) {
base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle();
uint32 size = 0;
gpu::Buffer buffer = command_buffer_->GetTransferBuffer(id);
if (buffer.shared_memory) {
- // Assume service is responsible for duplicating the handle to the calling
- // process.
- buffer.shared_memory->ShareToProcess(channel_->renderer_process(),
+#if defined(OS_WIN)
+ transfer_buffer = NULL;
+ sandbox::BrokerDuplicateHandle(buffer.shared_memory->handle(),
+ channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ |
+ FILE_MAP_WRITE, 0);
+ CHECK(transfer_buffer != NULL);
+#else
+ buffer.shared_memory->ShareToProcess(channel_->renderer_pid(),
&transfer_buffer);
+#endif
size = buffer.size;
}
@@ -557,8 +553,7 @@
new GpuVideoDecodeAccelerator(this, decoder_route_id, this);
video_decoders_.AddWithID(decoder, decoder_route_id);
channel_->AddRoute(decoder_route_id, decoder);
- decoder->Initialize(profile, reply_message,
- channel_->renderer_process());
+ decoder->Initialize(profile, reply_message);
}
void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698