summaryrefslogtreecommitdiffstats
path: root/content/common/gpu/client
diff options
context:
space:
mode:
Diffstat (limited to 'content/common/gpu/client')
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.cc24
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc11
-rw-r--r--content/common/gpu/client/gpu_channel_host.h11
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc2
4 files changed, 16 insertions, 32 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 1bb1887..1a23eac 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -20,10 +20,6 @@
#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(
@@ -238,13 +234,7 @@ int32 CommandBufferProxyImpl::CreateTransferBuffer(
return -1;
base::SharedMemoryHandle handle = shm->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;
- }
-#elif defined(OS_POSIX)
+#if defined(OS_POSIX)
DCHECK(!handle.auto_close);
#endif
@@ -267,20 +257,10 @@ int32 CommandBufferProxyImpl::RegisterTransferBuffer(
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_,
- handle,
+ shared_memory->handle(), // Returns FileDescriptor with auto_close off.
size,
id_request,
&id))) {
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index cda0468..988feae 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -93,10 +93,10 @@ void GpuChannelHost::MessageFilter::OnChannelError() {
}
GpuChannelHost::GpuChannelHost(
- GpuChannelHostFactory* factory, int gpu_host_id, int client_id)
+ GpuChannelHostFactory* factory, int gpu_process_id, int client_id)
: factory_(factory),
+ gpu_process_id_(gpu_process_id),
client_id_(client_id),
- gpu_host_id_(gpu_host_id),
state_(kUnconnected) {
}
@@ -104,7 +104,8 @@ GpuChannelHost::~GpuChannelHost() {
}
void GpuChannelHost::Connect(
- const IPC::ChannelHandle& channel_handle) {
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessHandle client_process_for_gpu) {
DCHECK(factory_->IsMainThread());
// Open a channel to the GPU process. We pass NULL as the main listener here
// since we need to filter everything to route it to the right thread.
@@ -129,6 +130,10 @@ void GpuChannelHost::Connect(
// and receives the hello message from the GPU process. The messages get
// cached.
state_ = kConnected;
+
+ // Notify the GPU process of our process handle. This gives it the ability
+ // to map client handles into the GPU process.
+ Send(new GpuChannelMsg_Initialize(client_process_for_gpu));
}
void GpuChannelHost::set_gpu_info(const content::GPUInfo& gpu_info) {
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h
index b82efe9..0a88845 100644
--- a/content/common/gpu/client/gpu_channel_host.h
+++ b/content/common/gpu/client/gpu_channel_host.h
@@ -13,7 +13,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/process.h"
#include "base/process_util.h"
#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
@@ -84,12 +83,13 @@ class GpuChannelHost : public IPC::Message::Sender,
// Called on the render thread
GpuChannelHost(GpuChannelHostFactory* factory,
- int gpu_host_id,
+ int gpu_process_id,
int client_id);
virtual ~GpuChannelHost();
// Connect to GPU process channel.
- void Connect(const IPC::ChannelHandle& channel_handle);
+ void Connect(const IPC::ChannelHandle& channel_handle,
+ base::ProcessHandle client_process_for_gpu);
State state() const { return state_; }
@@ -152,8 +152,7 @@ class GpuChannelHost : public IPC::Message::Sender,
void ForciblyCloseChannel();
GpuChannelHostFactory* factory() const { return factory_; }
- int gpu_host_id() const { return gpu_host_id_; }
- base::ProcessId gpu_pid() const { return channel_->peer_pid(); }
+ int gpu_process_id() const { return gpu_process_id_; }
int client_id() const { return client_id_; }
private:
@@ -181,8 +180,8 @@ class GpuChannelHost : public IPC::Message::Sender,
};
GpuChannelHostFactory* factory_;
+ int gpu_process_id_;
int client_id_;
- int gpu_host_id_;
State state_;
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index aa9c645..32e4c2d 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -484,7 +484,7 @@ void WebGraphicsContext3DCommandBufferImpl::Destroy() {
}
int WebGraphicsContext3DCommandBufferImpl::GetGPUProcessID() {
- return host_ ? host_->gpu_host_id() : 0;
+ return host_ ? host_->gpu_process_id() : 0;
}
int WebGraphicsContext3DCommandBufferImpl::GetChannelID() {