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

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

Issue 12684010: Add simple cache backend experiment hidden behind a flag. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: implemented just enough option states Created 7 years, 9 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 | « chrome/browser/chrome_browser_field_trials.h ('k') | chrome/common/chrome_switches.h » ('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 (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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const CommandLine& parsed_command_line) : 52 const CommandLine& parsed_command_line) :
53 parsed_command_line_(parsed_command_line) { 53 parsed_command_line_(parsed_command_line) {
54 } 54 }
55 55
56 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { 56 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
57 } 57 }
58 58
59 void ChromeBrowserFieldTrials::SetupFieldTrials( 59 void ChromeBrowserFieldTrials::SetupFieldTrials(
60 const base::Time& install_time) { 60 const base::Time& install_time) {
61 chrome_variations::SetupUniformityFieldTrials(install_time); 61 chrome_variations::SetupUniformityFieldTrials(install_time);
62 SetUpSimpleCacheFieldTrial();
62 #if !defined(OS_ANDROID) 63 #if !defined(OS_ANDROID)
63 SetupDesktopFieldTrials(); 64 SetupDesktopFieldTrials();
64 #endif // defined(OS_ANDROID) 65 #endif // defined(OS_ANDROID)
65 } 66 }
66 67
67 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials() { 68 void ChromeBrowserFieldTrials::SetupDesktopFieldTrials() {
68 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_); 69 prerender::ConfigurePrefetchAndPrerender(parsed_command_line_);
69 SpdyFieldTrial(); 70 SpdyFieldTrial();
70 WarmConnectionFieldTrial(); 71 WarmConnectionFieldTrial();
71 AutoLaunchChromeFieldTrial(); 72 AutoLaunchChromeFieldTrial();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #if defined(OS_CHROMEOS) 185 #if defined(OS_CHROMEOS)
185 avatar_menu_always_hidden = true; 186 avatar_menu_always_hidden = true;
186 #endif 187 #endif
187 base::FieldTrial* trial = base::FieldTrialList::Find("ShowProfileSwitcher"); 188 base::FieldTrial* trial = base::FieldTrialList::Find("ShowProfileSwitcher");
188 if (trial && (!ProfileManager::IsMultipleProfilesEnabled() || 189 if (trial && (!ProfileManager::IsMultipleProfilesEnabled() ||
189 avatar_menu_always_hidden)) { 190 avatar_menu_always_hidden)) {
190 trial->Disable(); 191 trial->Disable();
191 } 192 }
192 } 193 }
193 194
195 // Sets up the experiment. The actual cache backend choice is made in the net/
196 // internals by looking at the experiment state.
197 void ChromeBrowserFieldTrials::SetUpSimpleCacheFieldTrial() {
198 if (parsed_command_line_.HasSwitch(switches::kUseSimpleCacheBackend)) {
rvargas (doing something else) 2013/03/15 18:20:16 It is much simpler to remove the command line argu
SteveT 2013/03/15 18:30:41 This is true, but there are a couple small catches
199 std::string opt_value = parsed_command_line_.GetSwitchValueASCII(
SteveT 2013/03/15 17:32:49 nit: const std::string
pasko-google - do not use 2013/03/15 18:27:52 Done.
200 switches::kUseSimpleCacheBackend);
201 if (LowerCaseEqualsASCII(opt_value, "off")) {
202 // This is the default.
203 return;
204 }
205 const base::FieldTrial::Probability kDivisor = 100;
206 scoped_refptr<base::FieldTrial> trial(
207 base::FieldTrialList::FactoryGetFieldTrial("SimpleCacheTrial", kDivisor,
208 "No", 2013, 12, 31, NULL));
209 trial->UseOneTimeRandomization();
210 if (LowerCaseEqualsASCII(opt_value, "on")) {
211 trial->AppendGroup("Yes", 100);
212 return;
213 }
214 #if defined(OS_ANDROID)
215 if (LowerCaseEqualsASCII(opt_value, "experiment")) {
216 // TODO(pasko): Make this the default on Android when the simple cache
rvargas (doing something else) 2013/03/15 18:20:16 That would also mean that there's no need to speci
pasko-google - do not use 2013/03/15 19:05:30 I just wanted to be clear about the intentions. I
217 // adds a few more necessary features. Also adjust the probability.
218 base::FieldTrial::Probability simple_cache_probability = 1;
SteveT 2013/03/15 17:32:49 nit: const base::FieldTrial::Probability
pasko-google - do not use 2013/03/15 18:27:52 Done.
pasko-google - do not use 2013/03/15 18:27:52 Done.
219 trial->AppendGroup("Yes", simple_cache_probability);
220 trial->AppendGroup("Control", simple_cache_probability);
SteveT 2013/03/15 17:32:49 For now, you're going to want to call trial->grou
pasko-google - do not use 2013/03/15 18:27:52 Done.
221 return;
222 }
223 CHECK(0) << "Only values (on|off|experiment) are supported for option "
rvargas (doing something else) 2013/03/15 18:20:16 Please don't crash release builds based on a comma
pasko-google - do not use 2013/03/15 19:05:30 My argument: there is value in failing early on in
rvargas (doing something else) 2013/03/15 19:16:25 Not convinced. The most common mistake is not to f
pasko-google - do not use 2013/03/15 21:30:57 I still have the opinion that the message overhead
224 << switches::kUseSimpleCacheBackend << ".";
SteveT 2013/03/15 17:32:49 Question: There is no NOTREACHED() equivalent for
pasko-google - do not use 2013/03/15 18:27:52 I did not find one :(
225 #endif
226 CHECK(0) << "Only values (on|off) are supported for option "
227 << switches::kUseSimpleCacheBackend << ".";
228 }
229 }
230
194 void ChromeBrowserFieldTrials::SetUpCacheSensitivityAnalysisFieldTrial() { 231 void ChromeBrowserFieldTrials::SetUpCacheSensitivityAnalysisFieldTrial() {
195 const base::FieldTrial::Probability kDivisor = 100; 232 const base::FieldTrial::Probability kDivisor = 100;
196 233
197 base::FieldTrial::Probability sensitivity_analysis_probability = 0; 234 base::FieldTrial::Probability sensitivity_analysis_probability = 0;
198 235
199 scoped_refptr<base::FieldTrial> trial( 236 scoped_refptr<base::FieldTrial> trial(
200 base::FieldTrialList::FactoryGetFieldTrial("CacheSensitivityAnalysis", 237 base::FieldTrialList::FactoryGetFieldTrial("CacheSensitivityAnalysis",
201 kDivisor, "No", 238 kDivisor, "No",
202 2012, 12, 31, NULL)); 239 2012, 12, 31, NULL));
203 trial->AppendGroup("ControlA", sensitivity_analysis_probability); 240 trial->AppendGroup("ControlA", sensitivity_analysis_probability);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // Call |FindValue()| on the trials below, which may come from the server, to 274 // Call |FindValue()| on the trials below, which may come from the server, to
238 // ensure they get marked as "used" for the purposes of data reporting. 275 // ensure they get marked as "used" for the purposes of data reporting.
239 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); 276 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial");
240 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); 277 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial");
241 base::FieldTrialList::FindValue("InstantDummy"); 278 base::FieldTrialList::FindValue("InstantDummy");
242 base::FieldTrialList::FindValue("InstantChannel"); 279 base::FieldTrialList::FindValue("InstantChannel");
243 base::FieldTrialList::FindValue("Test0PercentDefault"); 280 base::FieldTrialList::FindValue("Test0PercentDefault");
244 // Activate the autocomplete dynamic field trials. 281 // Activate the autocomplete dynamic field trials.
245 OmniboxFieldTrial::ActivateDynamicTrials(); 282 OmniboxFieldTrial::ActivateDynamicTrials();
246 } 283 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698