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

Unified Diff: chrome/app/client_util.cc

Issue 7508034: Make a pre-read A/B field-trial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | chrome/browser/browser_main.cc » ('j') | chrome/browser/browser_main_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/client_util.cc
===================================================================
--- chrome/app/client_util.cc (revision 95298)
+++ chrome/app/client_util.cc (working copy)
@@ -11,10 +11,11 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "base/win/registry.h"
+#include "base/rand_util.h" // For PreReadExperiment.
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
+#include "base/win/registry.h"
#include "chrome/app/breakpad_win.h"
#include "chrome/app/client_util.h"
#include "chrome/common/chrome_constants.h"
@@ -126,6 +127,9 @@
DWORD pre_read_step_size = kStepSize;
DWORD pre_read = 1;
+ // TODO(chrisha): This path should not be ChromeFrame specific, and it
+ // should not be hard-coded with 'Google' in the path. Rather, it should
+ // use the product name.
base::win::RegKey key(HKEY_CURRENT_USER, L"Software\\Google\\ChromeFrame",
KEY_QUERY_VALUE);
if (key.Valid()) {
@@ -134,6 +138,26 @@
key.ReadValueDW(L"PreRead", &pre_read);
key.Close();
}
+
+ // The Syzygy project is a competing optimization technique. Part of the
+ // evaluation consists of an A/B experiment. As a baseline, we wish to
+ // evaluate startup time with preread enabled and disabled. We can't use
+ // base::FieldTrial as this only exists *after* chrome.dll is loaded. We
+ // override the registry setting with a coin-toss for the duration of the
+ // experiment.
+ // NOTE: This experiment is intended for Canary and Dev only, and should be
+ // removed from any branch heading out to beta and beyond!
+ pre_read = base::RandInt(0, 1);
+ DCHECK(pre_read == 0 || pre_read == 1);
+
+ // We communicate the coin-toss result via a side-channel
+ // (environment variable) to chrome.dll. This ensures that chrome.dll
+ // only reports experiment results if it has been launched by a
+ // chrome.exe that is actually running the experiment.
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ DCHECK(env.get() != NULL);
+ env->SetVar("CHROME_PRE_READ_EXPERIMENT", pre_read ? "1" : "0");
+
if (pre_read) {
TRACE_EVENT_BEGIN_ETW("PreReadImage", 0, "");
file_util::PreReadImage(dir->c_str(), pre_read_size, pre_read_step_size);
« no previous file with comments | « no previous file | chrome/browser/browser_main.cc » ('j') | chrome/browser/browser_main_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698