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

Side by Side Diff: chrome/browser/chrome_browser_field_trials_mobile.cc

Issue 151183006: Set up field trial for precache experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/precache/content/precache_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_field_trials_mobile.h" 5 #include "chrome/browser/chrome_browser_field_trials_mobile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/chrome_version_info.h"
14 14
15 namespace chrome { 15 namespace chrome {
16 16
17 const char kEnabled[] = "Enabled";
18 const char kDisabled[] = "Disabled";
19
17 namespace { 20 namespace {
18 21
19 // Base function used by all data reduction proxy field trials. A trial is 22 // Base function used by all data reduction proxy field trials. A trial is
20 // only conducted for installs that are in the "Enabled" group. They are always 23 // only conducted for installs that are in the "Enabled" group. They are always
21 // enabled on DEV and BETA channels, and for STABLE, a percentage will be 24 // enabled on DEV and BETA channels, and for STABLE, a percentage will be
22 // controlled from the server. Until the percentage is learned from the server, 25 // controlled from the server. Until the percentage is learned from the server,
23 // a client-side configuration is used. 26 // a client-side configuration is used.
24 void DataCompressionProxyBaseFieldTrial( 27 void DataCompressionProxyBaseFieldTrial(
25 const char* trial_name, 28 const char* trial_name,
26 const base::FieldTrial::Probability enabled_group_probability, 29 const base::FieldTrial::Probability enabled_group_probability,
27 const base::FieldTrial::Probability total_probability) { 30 const base::FieldTrial::Probability total_probability) {
28 const char kEnabled[] = "Enabled";
29 const char kDisabled[] = "Disabled";
30 31
31 // Find out if this is a stable channel. 32 // Find out if this is a stable channel.
32 const bool kIsStableChannel = 33 const bool kIsStableChannel =
33 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; 34 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
34 35
35 // Experiment enabled until Jan 1, 2015. By default, disabled. 36 // Experiment enabled until Jan 1, 2015. By default, disabled.
36 scoped_refptr<base::FieldTrial> trial( 37 scoped_refptr<base::FieldTrial> trial(
37 base::FieldTrialList::FactoryGetFieldTrial( 38 base::FieldTrialList::FactoryGetFieldTrial(
38 trial_name, 39 trial_name,
39 total_probability, 40 total_probability,
(...skipping 19 matching lines...) Expand all
59 60
60 // Governs the rollout of the _promo_ for the compression proxy 61 // Governs the rollout of the _promo_ for the compression proxy
61 // independently from the rollout of compression proxy. The enabled 62 // independently from the rollout of compression proxy. The enabled
62 // percentage is configured to be 10% = 100 / 1000 until overridden by the 63 // percentage is configured to be 10% = 100 / 1000 until overridden by the
63 // server. When this trial is "Enabled," users get a promo, whereas 64 // server. When this trial is "Enabled," users get a promo, whereas
64 // otherwise, compression is available without a promo. 65 // otherwise, compression is available without a promo.
65 DataCompressionProxyBaseFieldTrial( 66 DataCompressionProxyBaseFieldTrial(
66 "DataCompressionProxyPromoVisibility", 100, 1000); 67 "DataCompressionProxyPromoVisibility", 100, 1000);
67 } 68 }
68 69
70 // Configures the "Precache" field trial. A trial is only conducted for installs
71 // that are in the "Enabled" group. Until the percentage is learned from the
72 // server, a client-side configuration is used.
73 void PrecacheFieldTrial() {
Alexei Svitkine (slow) 2014/02/12 15:41:50 I'm not sure this block of code actually buys you
74 // Experiment enabled until December 31, 2015. By default, disabled.
75 scoped_refptr<base::FieldTrial> trial(
76 base::FieldTrialList::FactoryGetFieldTrial(
77 "Precache", 1000, kDisabled, 2015, 12, 31,
78 base::FieldTrial::ONE_TIME_RANDOMIZED, NULL));
79
80 const int kEnabledGroup = trial->AppendGroup(kEnabled, 0);
81
82 VLOG(1) << "Precache enabled group id: " << kEnabledGroup
83 << ". Selected group id: " << trial->group();
84 }
85
69 } // namespace 86 } // namespace
70 87
71 void SetupMobileFieldTrials(const CommandLine& parsed_command_line, 88 void SetupMobileFieldTrials(const CommandLine& parsed_command_line,
72 const base::Time& install_time, 89 const base::Time& install_time,
73 PrefService* local_state) { 90 PrefService* local_state) {
74 DataCompressionProxyFieldTrials(); 91 DataCompressionProxyFieldTrials();
92 PrecacheFieldTrial();
75 } 93 }
76 94
77 } // namespace chrome 95 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698