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

Unified Diff: chrome/browser/chrome_browser_field_trials_desktop.cc

Issue 23534009: Re-enable pre-read experiment as a finch field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Declare all of the experiment groups... and other refactorings. Created 7 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
Index: chrome/browser/chrome_browser_field_trials_desktop.cc
diff --git a/chrome/browser/chrome_browser_field_trials_desktop.cc b/chrome/browser/chrome_browser_field_trials_desktop.cc
index 7096ba830b78c036b6605f8fb30b835dae9dc491..66c363f0a04e1f47e0f40f62b16d033f587e1017 100644
--- a/chrome/browser/chrome_browser_field_trials_desktop.cc
+++ b/chrome/browser/chrome_browser_field_trials_desktop.cc
@@ -9,6 +9,7 @@
#include "apps/field_trial_names.h"
#include "apps/pref_names.h"
#include "base/command_line.h"
+#include "base/environment.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
@@ -20,6 +21,7 @@
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/ui/sync/one_click_signin_helper.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/metrics/variations/variations_util.h"
@@ -125,6 +127,46 @@ void SetupLowLatencyFlashAudioFieldTrial() {
trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25);
}
+void SetupPreReadFieldTrial() {
+#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
Alexei Svitkine (slow) 2013/08/29 17:44:05 Is there a reason this should only be activated in
Roger McFarlane (Chromium) 2013/08/30 21:27:37 Done.
+ // The browser pre-read trial is Windows and Google Chrome specific. The
+ // chrome.exe process will have set an environment variable with the group
+ // name into which this client belongs.
+ std::string group;
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ env->GetVar(chrome::kPreReadEnvironmentVariable, &group);
+
+ // Initialize the field trial. We declare all of the groups here (so that
+ // the dashboard creation tools can find them) but force the probability
+ // of being assigned to the group already chosen by chrome.exe to 100%.
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial(
+ "BrowserPreReadExperiment", 100, "100%-Default",
+ 2014, 7, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL));
+ trial->AppendGroup("100%-Control", group == "100%-Control" ? 100 : 0);
+ trial->AppendGroup("95%", group == "95%" ? 100 : 0);
+ trial->AppendGroup("90%", group == "90%" ? 100 : 0);
+ trial->AppendGroup("85%", group == "85%" ? 100 : 0);
+ trial->AppendGroup("80%", group == "80%" ? 100 : 0);
+ trial->AppendGroup("75%", group == "75%" ? 100 : 0);
+ trial->AppendGroup("70%", group == "70%" ? 100 : 0);
+ trial->AppendGroup("65%", group == "65%" ? 100 : 0);
+ trial->AppendGroup("60%", group == "60%" ? 100 : 0);
+ trial->AppendGroup("55%", group == "55%" ? 100 : 0);
+ trial->AppendGroup("50%", group == "50%" ? 100 : 0);
+ trial->AppendGroup("45%", group == "45%" ? 100 : 0);
+ trial->AppendGroup("40%", group == "40%" ? 100 : 0);
+ trial->AppendGroup("35%", group == "35%" ? 100 : 0);
+ trial->AppendGroup("30%", group == "30%" ? 100 : 0);
+ trial->AppendGroup("25%", group == "25%" ? 100 : 0);
+ trial->AppendGroup("20%", group == "20%" ? 100 : 0);
+ trial->AppendGroup("15%", group == "15%" ? 100 : 0);
+ trial->AppendGroup("10%", group == "10%" ? 100 : 0);
+ trial->AppendGroup("5%", group == "5%" ? 100 : 0);
+ trial->AppendGroup("0%", group == "0%" ? 100 : 0);
+#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+}
+
} // namespace
void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
@@ -139,6 +181,7 @@ void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
DisableShowProfileSwitcherTrialIfNecessary();
SetupAppLauncherFieldTrial(local_state);
SetupLowLatencyFlashAudioFieldTrial();
+ SetupPreReadFieldTrial();
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698