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; |