Index: chrome/browser/browser_main.cc |
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc |
index e8c9724b6e25e6e0dcfbe138ed8572e0603aacc5..f06f716442f332fd3be7ce998aa4b9f248b2396d 100644 |
--- a/chrome/browser/browser_main.cc |
+++ b/chrome/browser/browser_main.cc |
@@ -1324,8 +1324,20 @@ int BrowserMain(const MainFunctionParams& parameters) { |
about_flags::ConvertFlagsToSwitches(local_state, |
CommandLine::ForCurrentProcess()); |
- // Now the command line has been mutated based on about:flags, we can run some |
- // field trials |
+ // Must initialize metrics after labs have been converted into switches, |
+ // but before field trials are set up (so that client ID is available for |
+ // one-time randomized field trials). |
+ MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); |
jar (doing other things)
2011/04/29 00:57:11
This will probably work. I'm always nervous about
Jói
2011/05/02 18:55:03
I will watch the startup perf dash.
Jói
2011/05/05 15:07:39
Just to confirm, I looked in detail at every Start
|
+ |
+ // Initialize FieldTrialList to support FieldTrials that use one-time |
+ // randomization. The client ID will be empty if the user has not opted |
+ // to send metrics. |
+ std::string client_id = metrics->GetClientId(); |
+ if (!client_id.empty()) |
+ base::FieldTrialList::EnableOneTimeRandomization(client_id); |
+ |
+ // Now the command line has been mutated based on about:flags, and one-time |
+ // randomization has been enabled, we can run some field trials |
parts->SetupFieldTrials(); |
jar (doing other things)
2011/04/29 00:57:11
Wouldn't lines 1327-1337 fit nicely into SetupFiel
Jói
2011/05/02 18:55:03
Good point. I've factored it out.
|
// Now that all preferences have been registered, set the install date |
@@ -1670,7 +1682,6 @@ int BrowserMain(const MainFunctionParams& parameters) { |
sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher); |
sdch_manager.EnableSdchSupport(sdch_supported_domain); |
- MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); |
InstallJankometer(parsed_command_line); |
#if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) |