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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1c9a854e5c034f3c4c1a199cb271b27e3dab09aa..6a1765926dd0789aa314dfc482e43117662b9439 100644
--- a/chrome/browser/chrome_browser_field_trials.cc
+++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -59,6 +59,7 @@ ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() {
void ChromeBrowserFieldTrials::SetupFieldTrials(
const base::Time& install_time) {
chrome_variations::SetupUniformityFieldTrials(install_time);
+ SetUpSimpleCacheFieldTrial();
#if !defined(OS_ANDROID)
SetupDesktopFieldTrials();
#endif // defined(OS_ANDROID)
@@ -191,6 +192,42 @@ void ChromeBrowserFieldTrials::DisableShowProfileSwitcherTrialIfNecessary() {
}
}
+// Sets up the experiment. The actual cache backend choice is made in the net/
+// internals by looking at the experiment state.
+void ChromeBrowserFieldTrials::SetUpSimpleCacheFieldTrial() {
+ 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
+ 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.
+ switches::kUseSimpleCacheBackend);
+ if (LowerCaseEqualsASCII(opt_value, "off")) {
+ // This is the default.
+ return;
+ }
+ const base::FieldTrial::Probability kDivisor = 100;
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial("SimpleCacheTrial", kDivisor,
+ "No", 2013, 12, 31, NULL));
+ trial->UseOneTimeRandomization();
+ if (LowerCaseEqualsASCII(opt_value, "on")) {
+ trial->AppendGroup("Yes", 100);
+ return;
+ }
+#if defined(OS_ANDROID)
+ if (LowerCaseEqualsASCII(opt_value, "experiment")) {
+ // 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
+ // adds a few more necessary features. Also adjust the probability.
+ 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.
+ trial->AppendGroup("Yes", simple_cache_probability);
+ 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.
+ return;
+ }
+ 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
+ << 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 :(
+#endif
+ CHECK(0) << "Only values (on|off) are supported for option "
+ << switches::kUseSimpleCacheBackend << ".";
+ }
+}
+
void ChromeBrowserFieldTrials::SetUpCacheSensitivityAnalysisFieldTrial() {
const base::FieldTrial::Probability kDivisor = 100;
« 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