summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 07:38:17 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 07:38:17 +0000
commitb13afb7fc94878a390a29e89f6a07d68d4248000 (patch)
treee2439e07eded573de480edea44b5c4d34573307c /content
parent45d6497969b8e8ee154f7b5f185045e3da62e726 (diff)
downloadchromium_src-b13afb7fc94878a390a29e89f6a07d68d4248000.zip
chromium_src-b13afb7fc94878a390a29e89f6a07d68d4248000.tar.gz
chromium_src-b13afb7fc94878a390a29e89f6a07d68d4248000.tar.bz2
Asynchronously launch the GPU process as soon as the IO thread is ready.
When the first tab is composited, this results in the GPU process being initialized about 100ms earlier on my box. Review URL: https://chromiumcodereview.appspot.com/10445002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_main_loop.cc28
-rw-r--r--content/public/common/content_switches.cc4
-rw-r--r--content/public/common/content_switches.h1
3 files changed, 19 insertions, 14 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 3a92507..ac9ca7b 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -430,20 +430,6 @@ void BrowserMainLoop::CreateThreads() {
// Do not allow disk IO from the UI thread.
base::ThreadRestrictions::SetIOAllowed(false);
base::ThreadRestrictions::DisallowWaiting();
-
- // When running the GPU thread in-process, avoid optimistically starting it
- // since creating the GPU thread races against creation of the one-and-only
- // ChildProcess instance which is created by the renderer thread.
- if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) &&
- !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) {
- BrowserThread::PostDelayedTask(
- BrowserThread::IO, FROM_HERE, base::Bind(
- base::IgnoreResult(&GpuProcessHost::Get),
- GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
- content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP),
- // Arbitrary delay to avoid allow browser init precious CPU cycles.
- base::TimeDelta::FromSeconds(5));
- }
}
void BrowserMainLoop::RunMainMessageLoopParts() {
@@ -600,6 +586,20 @@ void BrowserMainLoop::BrowserThreadsStarted() {
speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl());
#endif
+ // When running the GPU thread in-process, avoid optimistically starting it
+ // since creating the GPU thread races against creation of the one-and-only
+ // ChildProcess instance which is created by the renderer thread.
+ if (!parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) &&
+ !parsed_command_line_.HasSwitch(switches::kSingleProcess) &&
+ !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) {
+ TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process");
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE, base::Bind(
+ base::IgnoreResult(&GpuProcessHost::Get),
+ GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
+ content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP));
+ }
+
// Start the GpuDataManager before we set up the MessageLoops because
// otherwise we'll trigger the assertion about doing IO on the UI thread.
content::GpuDataManager::GetInstance();
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 5f7544c..e2c8ebd 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -105,6 +105,10 @@ const char kDisableGeolocation[] = "disable-geolocation";
// Disable GL multisampling.
const char kDisableGLMultisampling[] = "disable-gl-multisampling";
+// Do not launch the GPU process shortly after browser process launch. Instead
+// launch it when it is first needed.
+const char kDisableGpuProcessPrelaunch[] = "diasable-gpu-process-prelaunch";
+
// Disable the GPU process sandbox.
const char kDisableGpuSandbox[] = "disable-gpu-sandbox";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index d39cd41..59b27ff 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -44,6 +44,7 @@ CONTENT_EXPORT extern const char kBlacklistWebGL[];
extern const char kDisableFileSystem[];
extern const char kDisableGeolocation[];
CONTENT_EXPORT extern const char kDisableGLMultisampling[];
+CONTENT_EXPORT extern const char kDisableGpuProcessPrelaunch[];
extern const char kDisableGpuSandbox[];
extern const char kReduceGpuSandbox[];
extern const char kDisableGpuWatchdog[];