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

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

Issue 6883102: Add one-time randomization support for FieldTrial, and the ability to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responding to review comments. Fix initialization in browser_main. Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/rand_util.cc ('k') | chrome/browser/metrics/metrics_service.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 1317
1318 // Initialize thread watcher system. This is a singleton and is used by 1318 // Initialize thread watcher system. This is a singleton and is used by
1319 // WatchDogThread to keep track of information about threads that are being 1319 // WatchDogThread to keep track of information about threads that are being
1320 // watched. 1320 // watched.
1321 scoped_ptr<ThreadWatcherList> thread_watcher_list(new ThreadWatcherList()); 1321 scoped_ptr<ThreadWatcherList> thread_watcher_list(new ThreadWatcherList());
1322 1322
1323 // Convert active labs into switches. Modifies the current command line. 1323 // Convert active labs into switches. Modifies the current command line.
1324 about_flags::ConvertFlagsToSwitches(local_state, 1324 about_flags::ConvertFlagsToSwitches(local_state,
1325 CommandLine::ForCurrentProcess()); 1325 CommandLine::ForCurrentProcess());
1326 1326
1327 // Now the command line has been mutated based on about:flags, we can run some 1327 // Must initialize metrics after labs have been converted into switches,
1328 // field trials 1328 // but before field trials are set up (so that client ID is available for
1329 // one-time randomized field trials).
1330 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
1331
1332 // Initialize FieldTrialList to support FieldTrials that use one-time
1333 // randomization. The client ID will be empty if the user has not opted
1334 // to send metrics.
1335 std::string client_id = metrics->GetClientId();
1336 if (!client_id.empty())
1337 base::FieldTrialList::EnableOneTimeRandomization(client_id);
1338
1339 // Now the command line has been mutated based on about:flags, and one-time
1340 // randomization has been enabled, we can run some field trials
1329 parts->SetupFieldTrials(); 1341 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.
1330 1342
1331 // Now that all preferences have been registered, set the install date 1343 // Now that all preferences have been registered, set the install date
1332 // for the uninstall metrics if this is our first run. This only actually 1344 // for the uninstall metrics if this is our first run. This only actually
1333 // gets used if the user has metrics reporting enabled at uninstall time. 1345 // gets used if the user has metrics reporting enabled at uninstall time.
1334 int64 install_date = 1346 int64 install_date =
1335 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); 1347 local_state->GetInt64(prefs::kUninstallMetricsInstallDate);
1336 if (install_date == 0) { 1348 if (install_date == 0) {
1337 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, 1349 local_state->SetInt64(prefs::kUninstallMetricsInstallDate,
1338 base::Time::Now().ToTimeT()); 1350 base::Time::Now().ToTimeT());
1339 } 1351 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 sdch_trial->AppendGroup("global_disable_sdch", 1675 sdch_trial->AppendGroup("global_disable_sdch",
1664 kSDCH_DISABLE_PROBABILITY); 1676 kSDCH_DISABLE_PROBABILITY);
1665 if (sdch_enabled != sdch_trial->group()) 1677 if (sdch_enabled != sdch_trial->group())
1666 sdch_supported_domain = "never_enabled_sdch_for_any_domain"; 1678 sdch_supported_domain = "never_enabled_sdch_for_any_domain";
1667 } 1679 }
1668 1680
1669 net::SdchManager sdch_manager; // Singleton database. 1681 net::SdchManager sdch_manager; // Singleton database.
1670 sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher); 1682 sdch_manager.set_sdch_fetcher(new SdchDictionaryFetcher);
1671 sdch_manager.EnableSdchSupport(sdch_supported_domain); 1683 sdch_manager.EnableSdchSupport(sdch_supported_domain);
1672 1684
1673 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state);
1674 InstallJankometer(parsed_command_line); 1685 InstallJankometer(parsed_command_line);
1675 1686
1676 #if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) 1687 #if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD)
1677 if (parsed_command_line.HasSwitch(switches::kDebugPrint)) { 1688 if (parsed_command_line.HasSwitch(switches::kDebugPrint)) {
1678 FilePath path = 1689 FilePath path =
1679 parsed_command_line.GetSwitchValuePath(switches::kDebugPrint); 1690 parsed_command_line.GetSwitchValuePath(switches::kDebugPrint);
1680 printing::PrintedDocument::set_debug_dump_path(path); 1691 printing::PrintedDocument::set_debug_dump_path(path);
1681 } 1692 }
1682 #endif 1693 #endif
1683 1694
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 #if defined(OS_CHROMEOS) 1899 #if defined(OS_CHROMEOS)
1889 // To be precise, logout (browser shutdown) is not yet done, but the 1900 // To be precise, logout (browser shutdown) is not yet done, but the
1890 // remaining work is negligible, hence we say LogoutDone here. 1901 // remaining work is negligible, hence we say LogoutDone here.
1891 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1902 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1892 false); 1903 false);
1893 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1904 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1894 #endif 1905 #endif
1895 TRACE_EVENT_END("BrowserMain", 0, 0); 1906 TRACE_EVENT_END("BrowserMain", 0, 0);
1896 return result_code; 1907 return result_code;
1897 } 1908 }
OLDNEW
« no previous file with comments | « base/rand_util.cc ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698