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

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, 5 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.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 field-trial.
#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,12 +127,34 @@
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()) {
key.ReadValueDW(L"PreReadSize", &pre_read_size);
key.ReadValueDW(L"PreReadStepSize", &pre_read_step_size);
- key.ReadValueDW(L"PreRead", &pre_read);
+ // Use 'PreReadExperiment' rather than 'PreRead' for now.
+ // key.ReadValueDW(L"PreRead", &pre_read);
+
+ // The Syzygy project is a competing optimization technique. Part of the
+ // evaluation consists of an A/B experiment on Canary. 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, thus we store the result of our coin-toss in the registry. We
+ // do this using a separate registry key so that we can revert to the
+ // old behaviour after the experiment.
+ const wchar_t kPreReadExperimentKey[] = L"PreReadExperiment";
Sigurður Ásgeirsson 2011/08/04 13:35:32 nit: static
chrisha 2011/08/04 14:48:40 Done.
+ // Try to look up the earlier result.
+ if (key.ReadValueDW(kPreReadExperimentKey, &pre_read) != 0) {
+ // If this fails, toss a coin and save the result. The coin-toss is only
+ // used if it has been successfully written.
+ DWORD coin_toss = base::RandInt(0, 1);
+ if (key.WriteValue(kPreReadExperimentKey, coin_toss) == 0)
jar (doing other things) 2011/08/03 21:24:34 It is undesirable to save a random number into the
Sigurður Ásgeirsson 2011/08/04 13:35:32 The range of the coin_toss here is 0 to 1. It woul
chrisha 2011/08/04 14:48:40 Done.
jar (doing other things) 2011/08/04 18:34:28 My apologies for my mis-read. Thanks for the asse
+ pre_read = coin_toss;
+ }
+
key.Close();
}
if (pre_read) {
« no previous file with comments | « no previous file | chrome/browser/browser_main.cc » ('j') | chrome/browser/browser_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698