| 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);
|
|
|