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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 1297953004: Support mojo applications in GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 2 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/browser/gpu/gpu_process_host.h ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698