From 515c71659b320d501ca37fa7a3a39b2cf3a6d6f8 Mon Sep 17 00:00:00 2001 From: "apatrick@chromium.org" Date: Mon, 12 Jul 2010 23:46:17 +0000 Subject: Asynchronously launches the GPU process. - First renderer process sends IPC to browser process causing it to prelaunch the GPU process. - IPC channel is subsequently established. - If EstablishAsyncChannelSync is not called during this period, it will not block. - Future renderer processes simply asynchronously establish the IPC channel. - This also causes the GPU process to be relaunched if it crashed. TEST=try, observed that GPU process launches even for pages without 3D content BUG=none Review URL: http://codereview.chromium.org/2952005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52152 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/browser_render_process_host.cc | 1 + chrome/common/chrome_switches.cc | 4 ++++ chrome/common/chrome_switches.h | 1 + chrome/renderer/render_thread.cc | 8 ++++++++ 4 files changed, 14 insertions(+) (limited to 'chrome') diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 411a597..e945628 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -575,6 +575,7 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( switches::kRemoteShellPort, switches::kEnablePepperTesting, switches::kEnableChromoting, + switches::kPrelaunchGpuProcess, }; for (size_t i = 0; i < arraysize(switch_names); ++i) { diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 83caf08..127baac 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -674,6 +674,10 @@ const char kPluginStartupDialog[] = "plugin-startup-dialog"; // possibly be used for connections. const char kPreconnectDespiteProxy[] = "preconnect-despite-proxy"; +// Establishes a channel to the GPU process asynchronously and (re)launches it +// if necessary when a renderer process starts. +const char kPrelaunchGpuProcess[] = "prelaunch-gpu-process"; + // Prints the pages on the screen. const char kPrint[] = "print"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 87755e7..558189d 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -200,6 +200,7 @@ extern const char kPluginPath[]; extern const char kPluginProcess[]; extern const char kPluginStartupDialog[]; extern const char kPreconnectDespiteProxy[]; +extern const char kPrelaunchGpuProcess[]; extern const char kPrint[]; extern const char kProcessPerSite[]; extern const char kProcessPerTab[]; diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 30be754..95588c8 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -253,6 +253,14 @@ void RenderThread::Init() { suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter; AddFilter(suicide_on_channel_error_filter_.get()); #endif + + // Establish a channel to the GPU process asynchronously if requested. If the + // channel is established in time, EstablishGpuChannelSync will not block when + // it is later called. + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kPrelaunchGpuProcess)) { + EstablishGpuChannel(); + } } RenderThread::~RenderThread() { -- cgit v1.1