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

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: Address comments from chrisha and asvitkine. 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..f801165c3bca3c14233a9a6d4584ddca949ca9a8 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,44 @@ void SetupLowLatencyFlashAudioFieldTrial() {
trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25);
}
+void SetupPreReadFieldTrial() {
+ // The chrome executable will have set (or not) 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);
Alexei Svitkine (slow) 2013/09/03 14:59:16 Can you exit early if this env var isn't set (and
Roger McFarlane (Chromium) 2013/09/03 18:38:43 The default isn't no-preread, it's full pre-read.
+
+ // 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 the executable, if any,
+ // to 100%.
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial(
+ "BrowserPreReadExperiment", 100, "100%-Default",
Alexei Svitkine (slow) 2013/09/03 14:59:16 We generally discourage special characters in the
Roger McFarlane (Chromium) 2013/09/03 18:38:43 Done.
+ 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);
Alexei Svitkine (slow) 2013/09/03 14:59:16 You need to call trial->group() on the experiment
Roger McFarlane (Chromium) 2013/09/03 18:38:43 Done.
+}
+
} // namespace
void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
@@ -139,6 +179,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