Index: chrome/browser/chrome_browser_main.cc |
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
index e8612a18a4d7a25953c8afaf9187d781462b4dd1..1d374d183f887736167e925fed3ebbaa0cc2f348 100644 |
--- a/chrome/browser/chrome_browser_main.cc |
+++ b/chrome/browser/chrome_browser_main.cc |
@@ -707,38 +707,28 @@ void ChromeBrowserMainParts::RecordBrowserStartupTime() { |
new LoadCompleteListener(); |
} |
-// This code is specific to the Windows-only PreReadExperiment field-trial. |
void ChromeBrowserMainParts::RecordPreReadExperimentTime(const char* name, |
base::TimeDelta time) { |
DCHECK(name != NULL); |
- // This gets called with different histogram names, so we don't want to use |
- // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the |
- // first call wins. |
- AddPreReadHistogramTime(name, time); |
- |
#if defined(OS_WIN) |
#if defined(GOOGLE_CHROME_BUILD) |
- // The pre-read experiment is Windows and Google Chrome specific. |
+ // The pre-read experiment is Windows and Google Chrome specific. Only |
+ // initialize the field-trial if the experiment is running (environment |
+ // variable is set, and valid). |
scoped_ptr<base::Environment> env(base::Environment::Create()); |
- |
- // Only record the sub-histogram result if the experiment is running |
- // (environment variable is set, and valid). |
- std::string pre_read_percentage; |
- if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read_percentage)) { |
- std::string uma_name(name); |
- |
- // We want XP to record a separate histogram, as the loader on XP |
- // is very different from the Vista and Win7 loaders. |
- if (base::win::GetVersion() <= base::win::VERSION_XP) |
- uma_name += "_XP"; |
- |
- uma_name += "_PreRead_"; |
- uma_name += pre_read_percentage; |
- AddPreReadHistogramTime(uma_name.c_str(), time); |
+ std::string pre_read_group; |
+ if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read_group)) { |
Alexei Svitkine (slow)
2013/08/28 17:30:50
We have a script that parses source code to extrac
Roger McFarlane (Chromium)
2013/08/29 15:28:37
I've pulled this out to chrome_browser_field_trial
|
+ static const char kPreReadTrialName[] = "BrowserPreReadExperiment"; |
+ base::FieldTrialList::CreateFieldTrial(kPreReadTrialName, pre_read_group); |
Alexei Svitkine (slow)
2013/08/28 17:30:50
You need to call group() on returned FieldTrial* o
Roger McFarlane (Chromium)
2013/08/29 15:28:37
Having created a setup function for the experiment
|
} |
#endif |
#endif |
+ |
+ // This gets called with different histogram names, so we don't want to use |
+ // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the |
+ // first call wins. |
+ AddPreReadHistogramTime(name, time); |
} |
// ----------------------------------------------------------------------------- |