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

Unified Diff: chrome/renderer/render_thread.cc

Issue 3119002: Prelaunch GPU process after 10 seconds.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_thread.cc
===================================================================
--- chrome/renderer/render_thread.cc (revision 55471)
+++ chrome/renderer/render_thread.cc (working copy)
@@ -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 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 @@
// 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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698