OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "apps/field_trial_names.h" | 9 #include "apps/field_trial_names.h" |
10 #include "apps/pref_names.h" | 10 #include "apps/pref_names.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { | 63 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { |
64 const base::Time install_time = base::Time::FromTimeT( | 64 const base::Time install_time = base::Time::FromTimeT( |
65 local_state->GetInt64(prefs::kInstallDate)); | 65 local_state->GetInt64(prefs::kInstallDate)); |
66 DCHECK(!install_time.is_null()); | 66 DCHECK(!install_time.is_null()); |
67 chrome_variations::SetupUniformityFieldTrials(install_time); | 67 chrome_variations::SetupUniformityFieldTrials(install_time); |
68 SetUpSimpleCacheFieldTrial(); | 68 SetUpSimpleCacheFieldTrial(); |
69 #if !defined(OS_ANDROID) | 69 #if !defined(OS_ANDROID) |
70 SetupDesktopFieldTrials(local_state); | 70 SetupDesktopFieldTrials(local_state); |
71 #endif // defined(OS_ANDROID) | 71 #endif // defined(OS_ANDROID) |
72 | |
73 #if defined(OS_ANDROID) || defined(OS_IOS) | |
74 SetupMobileFieldTrials(); | |
75 #endif // defined(OS_ANDROID) || defined(OS_IOS) | |
76 } | |
77 | |
78 void ChromeBrowserFieldTrials::SetupMobileFieldTrials() { | |
79 DataCompressionProxyFieldTrial(); | |
72 } | 80 } |
73 | 81 |
74 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials( | 82 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials( |
75 PrefService* local_state) { | 83 PrefService* local_state) { |
76 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); | 84 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); |
77 SpdyFieldTrial(); | 85 SpdyFieldTrial(); |
78 WarmConnectionFieldTrial(); | 86 WarmConnectionFieldTrial(); |
79 AutoLaunchChromeFieldTrial(); | 87 AutoLaunchChromeFieldTrial(); |
80 gpu_util::InitializeCompositingFieldTrial(); | 88 gpu_util::InitializeCompositingFieldTrial(); |
81 OmniboxFieldTrial::ActivateStaticTrials(); | 89 OmniboxFieldTrial::ActivateStaticTrials(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 scoped_refptr<base::FieldTrial> trial( | 126 scoped_refptr<base::FieldTrial> trial( |
119 base::FieldTrialList::FactoryGetFieldTrial( | 127 base::FieldTrialList::FactoryGetFieldTrial( |
120 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2013, 6, 30, NULL)); | 128 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2013, 6, 30, NULL)); |
121 | 129 |
122 trial->AppendGroup("cwnd10", kSpdyCwnd10); | 130 trial->AppendGroup("cwnd10", kSpdyCwnd10); |
123 trial->AppendGroup("cwnd16", kSpdyCwnd16); | 131 trial->AppendGroup("cwnd16", kSpdyCwnd16); |
124 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); | 132 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); |
125 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); | 133 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); |
126 } | 134 } |
127 | 135 |
136 // Governs the rollout of the compression proxy for Chrome on mobile platforms. | |
137 // Always enabled in DEV and BETA versions. | |
138 // Stable percentage will be controlled from server. | |
139 void ChromeBrowserFieldTrials::DataCompressionProxyFieldTrial() { | |
140 const char kDataCompressionProxyFieldTrialName[] = | |
141 "DataCompressionProxyRollout"; | |
142 const base::FieldTrial::Probability kDataCompressionProxyDivisor = 1000; | |
143 const base::FieldTrial::Probability kDataCompressionProxyStable = 0; | |
SteveT
2013/03/29 17:40:55
So what's the plan? Stable is zero for now, and we
| |
144 const char kEnabled[] = "Enabled"; | |
145 const char kDisabled[] = "Disabled"; | |
146 | |
147 // Find out if this is a stable channel. | |
148 const bool kIsStableChannel = | |
149 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | |
150 | |
151 // Experiment enabled until Jan 1, 2015. By default, disabled. | |
152 scoped_refptr<base::FieldTrial> trial( | |
153 base::FieldTrialList::FactoryGetFieldTrial( | |
154 kDataCompressionProxyFieldTrialName, kDataCompressionProxyDivisor, | |
155 kDisabled, 2015, 1, 1, NULL)); | |
156 | |
157 // Non-stable channels will run with probability 1. | |
158 const int kEnabledGroup = trial->AppendGroup( | |
159 kEnabled, | |
160 kIsStableChannel ? | |
161 kDataCompressionProxyStable : kDataCompressionProxyDivisor); | |
162 | |
163 const int v = trial->group(); | |
164 VLOG(1) << "DataCompression proxy enabled group id: " << kEnabledGroup | |
165 << ". Selected group id: " << v; | |
166 } | |
167 | |
128 // If --socket-reuse-policy is not specified, run an A/B test for choosing the | 168 // If --socket-reuse-policy is not specified, run an A/B test for choosing the |
129 // warmest socket. | 169 // warmest socket. |
130 void ChromeBrowserFieldTrials::WarmConnectionFieldTrial() { | 170 void ChromeBrowserFieldTrials::WarmConnectionFieldTrial() { |
131 const CommandLine& command_line = parsed_command_line_; | 171 const CommandLine& command_line = parsed_command_line_; |
132 if (command_line.HasSwitch(switches::kSocketReusePolicy)) { | 172 if (command_line.HasSwitch(switches::kSocketReusePolicy)) { |
133 std::string socket_reuse_policy_str = command_line.GetSwitchValueASCII( | 173 std::string socket_reuse_policy_str = command_line.GetSwitchValueASCII( |
134 switches::kSocketReusePolicy); | 174 switches::kSocketReusePolicy); |
135 int policy = -1; | 175 int policy = -1; |
136 base::StringToInt(socket_reuse_policy_str, &policy); | 176 base::StringToInt(socket_reuse_policy_str, &policy); |
137 | 177 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 // Call |FindValue()| on the trials below, which may come from the server, to | 326 // Call |FindValue()| on the trials below, which may come from the server, to |
287 // ensure they get marked as "used" for the purposes of data reporting. | 327 // ensure they get marked as "used" for the purposes of data reporting. |
288 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); | 328 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); |
289 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); | 329 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); |
290 base::FieldTrialList::FindValue("InstantDummy"); | 330 base::FieldTrialList::FindValue("InstantDummy"); |
291 base::FieldTrialList::FindValue("InstantChannel"); | 331 base::FieldTrialList::FindValue("InstantChannel"); |
292 base::FieldTrialList::FindValue("Test0PercentDefault"); | 332 base::FieldTrialList::FindValue("Test0PercentDefault"); |
293 // Activate the autocomplete dynamic field trials. | 333 // Activate the autocomplete dynamic field trials. |
294 OmniboxFieldTrial::ActivateDynamicTrials(); | 334 OmniboxFieldTrial::ActivateDynamicTrials(); |
295 } | 335 } |
OLD | NEW |