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

Unified Diff: chrome/browser/chrome_browser_field_trials.cc

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to tab_capture_apitest.cc Created 6 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
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 02640502b115c5418357b7789e65b5bdea66c676..dae06514377e2b5fd6fbbbf44f446b10c5676249 100644
--- a/chrome/browser/chrome_browser_field_trials.cc
+++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -31,6 +31,59 @@ ChromeBrowserFieldTrials::ChromeBrowserFieldTrials(
ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
}
+namespace {
+
+// Base function used by all data reduction proxy field trials. A trial is
+// 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.
Alexei Svitkine (slow) 2014/07/21 20:25:35 I guess this is still OK if you really want to sup
Not at Google. Contact bengr 2014/07/21 21:45:09 Acknowledged.
+void DataCompressionProxyBaseFieldTrial(
+ const char* trial_name,
Alexei Svitkine (slow) 2014/07/21 20:25:35 Nit: Might as well make this a const std::string&
Not at Google. Contact bengr 2014/07/21 21:45:08 Done.
+ 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, 2020. By default, disabled.
Alexei Svitkine (slow) 2014/07/21 20:25:35 2020 is too far away. How about 2016 for now?
Not at Google. Contact bengr 2014/07/21 21:45:08 Done.
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial(
+ trial_name,
+ total_probability,
+ kDisabled, 2020, 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 all 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
Alexei Svitkine (slow) 2014/07/21 20:25:35 Do we have the promo UI on all platforms already?
Not at Google. Contact bengr 2014/07/21 21:45:09 No. Currently, this is not used on desktop and Chr
Alexei Svitkine (slow) 2014/07/22 13:48:23 Then it seems incorrect to set up a trial with 10%
Not at Google. Contact bengr 2014/07/22 23:03:52 The intention was that the trial would automatical
Alexei Svitkine (slow) 2014/07/23 14:35:26 Can you specify a default percentage of 0 on platf
Not at Google. Contact bengr 2014/08/26 17:31:08 We decided to remove the trial for rollout, so tha
+ // 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(const base::Time& install_time,
PrefService* local_state) {
DCHECK(!install_time.is_null());
@@ -38,6 +91,7 @@ void ChromeBrowserFieldTrials::SetupFieldTrials(const base::Time& install_time,
// Field trials that are shared by all platforms.
chrome_variations::SetupUniformityFieldTrials(install_time);
InstantiateDynamicTrials();
+ DataCompressionProxyFieldTrials();
Alexei Svitkine (slow) 2014/07/21 20:25:35 Nit: Rename to SetupDataCompressionProxyFieldTrial
Not at Google. Contact bengr 2014/07/21 21:45:09 Done.
#if defined(OS_ANDROID) || defined(OS_IOS)
chrome::SetupMobileFieldTrials(parsed_command_line_);

Powered by Google App Engine
This is Rietveld 408576698