Index: chrome/browser/chrome_browser_field_trials.cc |
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc |
index 655cf4564411ecff8fc0dc58aa88ac0a96d41633..9e65ba99482f68323a83f7dfb9346d10309dc208 100644 |
--- a/chrome/browser/chrome_browser_field_trials.cc |
+++ b/chrome/browser/chrome_browser_field_trials.cc |
@@ -31,6 +31,60 @@ ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( |
ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { |
} |
+namespace { |
+ |
+// Base function used by all data reduction proxy field trials. A trial is |
bengr
2014/07/17 00:11:07
We might be able to remove all of this.
Not at Google. Contact bengr
2014/07/17 18:10:21
Discussed in person. Will figure out rollout proce
|
+// only conducted for installs that are in the "Enabled" group. They are always |
+// enabled on DEV and BETA channels, and for STABLE, a percentage will be |
+// controlled from the server. Until the percentage is learned from the server, |
+// a client-side configuration is used. |
+void DataCompressionProxyBaseFieldTrial( |
+ const char* trial_name, |
+ const base::FieldTrial::Probability enabled_group_probability, |
+ const base::FieldTrial::Probability total_probability) { |
+ const char kEnabled[] = "Enabled"; |
+ const char kDisabled[] = "Disabled"; |
+ |
+ // Find out if this is a stable channel. |
+ const bool kIsStableChannel = |
+ chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
+ |
+ // Experiment enabled until Jan 1, 2015. By default, disabled. |
bengr
2014/07/17 00:11:07
We should change the expiration date to something
Not at Google. Contact bengr
2014/07/17 18:10:21
Changed to 2020.
|
+ scoped_refptr<base::FieldTrial> trial( |
+ base::FieldTrialList::FactoryGetFieldTrial( |
+ trial_name, |
+ total_probability, |
+ kDisabled, 2015, 1, 1, base::FieldTrial::ONE_TIME_RANDOMIZED, NULL)); |
+ |
+ // Non-stable channels will run with probability 1. |
+ const int kEnabledGroup = trial->AppendGroup( |
+ kEnabled, |
+ kIsStableChannel ? enabled_group_probability : total_probability); |
+ |
+ const int v = trial->group(); |
+ VLOG(1) << trial_name << " enabled group id: " << kEnabledGroup |
+ << ". Selected group id: " << v; |
+} |
+ |
+void DataCompressionProxyFieldTrials() { |
+ // Governs the rollout of the compression proxy for Chrome on mobile |
bengr
2014/07/17 00:11:07
all platforms, right?
Not at Google. Contact bengr
2014/07/17 18:10:21
Done.
|
+ // platforms. In all channels, the percentage will be controlled from the |
+ // server, and is configured to be 100% = 1000 / 1000 until overridden by the |
+ // server. |
+ DataCompressionProxyBaseFieldTrial( |
+ "DataCompressionProxyRollout", 1000, 1000); |
+ |
+ // Governs the rollout of the _promo_ for the compression proxy |
+ // independently from the rollout of compression proxy. The enabled |
+ // percentage is configured to be 10% = 100 / 1000 until overridden by the |
+ // server. When this trial is "Enabled," users get a promo, whereas |
+ // otherwise, compression is available without a promo. |
+ DataCompressionProxyBaseFieldTrial( |
+ "DataCompressionProxyPromoVisibility", 100, 1000); |
+} |
+ |
+} // namespace |
+ |
void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { |
const base::Time install_time = base::Time::FromTimeT( |
local_state->GetInt64(metrics::prefs::kInstallDate)); |
@@ -39,6 +93,7 @@ void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { |
// Field trials that are shared by all platforms. |
chrome_variations::SetupUniformityFieldTrials(install_time); |
InstantiateDynamicTrials(); |
+ DataCompressionProxyFieldTrials(); |
#if defined(OS_ANDROID) || defined(OS_IOS) |
chrome::SetupMobileFieldTrials( |