Index: content/browser/gpu/gpu_process_host.cc |
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
index 5839207424f06f56f3b324a90dc0533c3da73db1..805e1e1ab522b321a5b10e4608e40b7a6ff23f95 100644 |
--- a/content/browser/gpu/gpu_process_host.cc |
+++ b/content/browser/gpu/gpu_process_host.cc |
@@ -23,6 +23,7 @@ |
#include "content/browser/gpu/gpu_process_host_ui_shim.h" |
#include "content/browser/gpu/gpu_surface_tracker.h" |
#include "content/browser/gpu/shader_disk_cache.h" |
+#include "content/browser/mojo/mojo_application_host.h" |
#include "content/browser/renderer_host/render_widget_host_impl.h" |
#include "content/common/child_process_host_impl.h" |
#include "content/common/gpu/gpu_messages.h" |
@@ -543,6 +544,9 @@ bool GpuProcessHost::Init() { |
if (channel_id.empty()) |
return false; |
+ if (!SetupMojo()) |
+ return false; |
+ |
if (in_process_) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
DCHECK(g_gpu_main_thread_factory); |
@@ -575,6 +579,12 @@ bool GpuProcessHost::Init() { |
return true; |
} |
+bool GpuProcessHost::SetupMojo() { |
+ DCHECK(!mojo_application_host_); |
+ mojo_application_host_.reset(new MojoApplicationHost); |
+ return mojo_application_host_->Init(); |
+} |
+ |
void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { |
BrowserThread::PostTask( |
BrowserThread::UI, |
@@ -892,6 +902,14 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
void GpuProcessHost::OnProcessLaunched() { |
UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", |
base::TimeTicks::Now() - init_start_time_); |
+ |
+ base::ProcessHandle handle; |
+ if (in_process_) |
+ handle = base::GetCurrentProcessHandle(); |
+ else |
+ handle = process_->GetData().handle; |
+ |
+ mojo_application_host_->Activate(this, handle); |
} |
void GpuProcessHost::OnProcessLaunchFailed() { |
@@ -905,6 +923,10 @@ void GpuProcessHost::OnProcessCrashed(int exit_code) { |
process_->GetTerminationStatus(true /* known_dead */, NULL)); |
} |
+ServiceRegistry* GpuProcessHost::GetServiceRegistry() { |
+ return mojo_application_host_->service_registry(); |
+} |
+ |
GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { |
return kind_; |
} |