Index: content/browser/renderer_host/gpu_message_filter.cc |
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc |
index 856d14b9ecc83e356a5f25098b7ec166d97e7ddd..9a3bf2558b10edf5515557ce3c8848b1f51c158a 100644 |
--- a/content/browser/renderer_host/gpu_message_filter.cc |
+++ b/content/browser/renderer_host/gpu_message_filter.cc |
@@ -103,6 +103,25 @@ void GpuMessageFilter::EndFrameSubscription(int route_id) { |
} |
} |
+GpuProcessHost* GpuMessageFilter::GetGpuProcessHost( |
+ CauseForGpuLaunch cause_for_gpu_launch) { |
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_); |
+ if (!host) { |
+ host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
+ cause_for_gpu_launch); |
+ if (!host) { |
+ return NULL; |
+ } |
+ |
+ gpu_process_id_ = host->host_id(); |
+ |
+ // Apply all frame subscriptions to the new GpuProcessHost. |
+ BeginAllFrameSubscriptions(); |
+ } |
+ |
+ return host; |
+} |
+ |
void GpuMessageFilter::OnEstablishGpuChannel( |
CauseForGpuLaunch cause_for_gpu_launch, |
IPC::Message* reply_ptr) { |
@@ -116,20 +135,11 @@ void GpuMessageFilter::OnEstablishGpuChannel( |
// terminates, the renderer process will not find itself unknowingly sending |
// IPCs to a newly launched GPU process. Also, I will rename this function |
// to something like OnCreateGpuProcess. |
- GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_); |
+ GpuProcessHost* host = GetGpuProcessHost(cause_for_gpu_launch); |
if (!host) { |
- host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
- cause_for_gpu_launch); |
- if (!host) { |
- reply->set_reply_error(); |
- Send(reply.release()); |
- return; |
- } |
- |
- gpu_process_id_ = host->host_id(); |
- |
- // Apply all frame subscriptions to the new GpuProcessHost. |
- BeginAllFrameSubscriptions(); |
+ reply->set_reply_error(); |
+ Send(reply.release()); |
+ return; |
} |
bool share_contexts = true; |
@@ -169,7 +179,9 @@ void GpuMessageFilter::OnCreateViewCommandBuffer( |
compositing_surface = gfx::GLSurfaceHandle(); |
} |
- GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_); |
+ GpuProcessHost* host = GetGpuProcessHost( |
+ // This is currently the only creator of a view command buffer. |
+ CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
piman
2014/05/08 03:29:21
So, relaunching the GPU process is not actually go
Ken Russell (switch to Gerrit)
2014/05/09 01:36:13
Thanks for the feedback. I'll redo this as a check
|
if (!host || compositing_surface.is_null()) { |
// TODO(apatrick): Eventually, this IPC message will be routed to a |
// GpuProcessStub with a particular routing ID. The error will be set if |