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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 10081018: Revert 132218 - Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://svn.chromium.org/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.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel.cc
===================================================================
--- content/common/gpu/gpu_channel.cc (revision 132251)
+++ content/common/gpu/gpu_channel.cc (working copy)
@@ -40,6 +40,8 @@
bool software)
: gpu_channel_manager_(gpu_channel_manager),
client_id_(client_id),
+ renderer_process_(base::kNullProcessHandle),
+ renderer_pid_(base::kNullProcessId),
share_group_(share_group ? share_group : new gfx::GLShareGroup),
watchdog_(watchdog),
software_(software),
@@ -60,6 +62,10 @@
}
GpuChannel::~GpuChannel() {
+#if defined(OS_WIN)
+ if (renderer_process_)
+ CloseHandle(renderer_process_);
+#endif
}
bool GpuChannel::OnMessageReceived(const IPC::Message& message) {
@@ -107,6 +113,10 @@
gpu_channel_manager_->RemoveChannel(client_id_);
}
+void GpuChannel::OnChannelConnected(int32 peer_pid) {
+ renderer_pid_ = peer_pid;
+}
+
bool GpuChannel::Send(IPC::Message* message) {
// The GPU process must never send a synchronous IPC message to the renderer
// process. This could result in deadlock.
@@ -201,6 +211,7 @@
// here. This is so the reply can be delayed if the scheduler is unscheduled.
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
+ IPC_MESSAGE_HANDLER(GpuChannelMsg_Initialize, OnInitialize)
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer,
OnCreateOffscreenCommandBuffer)
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer,
@@ -301,6 +312,15 @@
return num_contexts_preferring_discrete_gpu_ > 0;
}
+void GpuChannel::OnInitialize(base::ProcessHandle renderer_process) {
+ // Initialize should only happen once.
+ DCHECK(!renderer_process_);
+
+ // Verify that the renderer has passed its own process handle.
+ if (base::GetProcId(renderer_process) == renderer_pid_)
+ renderer_process_ = renderer_process;
+}
+
void GpuChannel::OnCreateOffscreenCommandBuffer(
const gfx::Size& size,
const GPUCreateCommandBufferConfig& init_params,
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698