diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 00:18:24 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 00:18:24 +0000 |
commit | 92b35138bdeb1b4bc7cb0498e2ce742115e7e811 (patch) | |
tree | 81397dee5696bd772997b22308fc9426607cb49b /chrome/renderer | |
parent | 95a8885c7470e8a4572fa672728ba948535f2da1 (diff) | |
download | chromium_src-92b35138bdeb1b4bc7cb0498e2ce742115e7e811.zip chromium_src-92b35138bdeb1b4bc7cb0498e2ce742115e7e811.tar.gz chromium_src-92b35138bdeb1b4bc7cb0498e2ce742115e7e811.tar.bz2 |
Prelaunch GPU process after 10 seconds.
This will happen if the --prelaunch-gpu-process command line switch is present or for 5% of users in a field trial.
This is so we can collect some stats of GPU capabilities.
TEST=try, check --prelaunch-gpu-process works
BUG=none
Review URL: http://codereview.chromium.org/3119002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55510 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_thread.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 8ea6c08..cefea46 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/command_line.h" +#include "base/field_trial.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/nullable_string16.h" @@ -116,6 +117,9 @@ static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */; static const double kInitialExtensionIdleHandlerDelayS = 5.0 /* seconds */; static const int64 kMaxExtensionIdleHandlerDelayS = 5*60 /* seconds */; +static const int kPrelauchGpuPercentage = 5; +static const int kPrelauchGpuProcessDelayMS = 10000; + // Keep the global RenderThread in a TLS slot so it is impossible to access // incorrectly from the wrong thread. static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls( @@ -268,10 +272,19 @@ void RenderThread::Init() { // 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(); + // it is later called. Delays by a fixed period of time to avoid loading the + // GPU immediately in an attempt to not slow startup time. + scoped_refptr<FieldTrial> prelaunch_trial( + new FieldTrial("PrelaunchGpuProcessExperiment", 100)); + int prelaunch_group = prelaunch_trial->AppendGroup("prelaunch_gpu_process", + kPrelauchGpuPercentage); + if (prelaunch_group == prelaunch_trial->group() || + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kPrelaunchGpuProcess)) { + message_loop()->PostDelayedTask(FROM_HERE, + task_factory_->NewRunnableMethod( + &RenderThread::EstablishGpuChannel), + kPrelauchGpuProcessDelayMS); } } |