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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 2380043002: Do not register synthetic field trial before initializing TaskScheduler. (Closed)
Patch Set: Created 4 years, 3 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_main.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 81b1a58a590f42cbb940b96151fd309e0351467e..311cf340e24ec7ac426cbe27bfe5a565e90a5164 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -878,37 +878,11 @@ void ChromeBrowserMainParts::SetupFieldTrials() {
// This must be called after |local_state_| is initialized.
browser_field_trials_.SetupFieldTrials();
- // Enable Navigation Tracing only if a trace upload url is specified.
- if (command_line->HasSwitch(switches::kEnableNavigationTracing) &&
- command_line->HasSwitch(switches::kTraceUploadURL)) {
- tracing::SetupNavigationTracing();
- }
-
// Initialize FieldTrialSynchronizer system. This is a singleton and is used
// for posting tasks via base::Bind. Its deleted when it goes out of scope.
// Even though base::Bind does AddRef and Release, the object will not be
// deleted after the Task is executed.
field_trial_synchronizer_ = new FieldTrialSynchronizer();
-
- // Register a synthetic field trial for the sampling profiler configuration
- // that was already chosen.
- sampling_profiler_config_.RegisterSyntheticFieldTrial();
-
-#if defined(OS_WIN) || defined(OS_MACOSX) || \
- (defined(OS_LINUX) && !defined(OS_CHROMEOS))
- metrics::DesktopSessionDurationTracker::Initialize();
-#endif
-
-#if defined(OS_WIN)
- // Cleanup the PreRead field trial registry key.
- // TODO(fdoray): Remove this when M56 hits stable.
- const base::string16 pre_read_field_trial_registry_path =
- BrowserDistribution::GetDistribution()->GetRegistryPath() +
- L"\\PreReadFieldTrial";
- base::win::RegKey(HKEY_CURRENT_USER,
- pre_read_field_trial_registry_path.c_str(), KEY_SET_VALUE)
- .DeleteKey(L"");
-#endif // defined(OS_WIN)
}
void ChromeBrowserMainParts::SetupMetrics() {
@@ -934,6 +908,19 @@ void ChromeBrowserMainParts::SetupMetrics() {
// Don't enable instrumentation.
break;
}
+
+ // Enable Navigation Tracing only if a trace upload url is specified.
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnableNavigationTracing) &&
+ command_line->HasSwitch(switches::kTraceUploadURL)) {
+ tracing::SetupNavigationTracing();
robliao 2016/09/30 01:10:09 This section seems like it could go outside of Set
fdoray 2016/09/30 12:36:42 No longer changing this section in this CL.
+ }
+
+#if defined(OS_WIN) || defined(OS_MACOSX) || \
+ (defined(OS_LINUX) && !defined(OS_CHROMEOS))
+ metrics::DesktopSessionDurationTracker::Initialize();
+#endif
}
void ChromeBrowserMainParts::StartMetricsRecording() {
@@ -942,6 +929,11 @@ void ChromeBrowserMainParts::StartMetricsRecording() {
g_browser_process->metrics_service()->CheckForClonedInstall(
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));
+ // Register a synthetic field trial for the sampling profiler configuration
+ // that was already chosen. This must be done before the line below creates
+ // the first MetricsLog.
+ sampling_profiler_config_.RegisterSyntheticFieldTrial();
+
g_browser_process->GetMetricsServicesManager()->UpdateUploadPermissions(true);
}
@@ -1531,6 +1523,17 @@ void ChromeBrowserMainParts::PostBrowserStart() {
}
#endif
+#if defined(OS_WIN)
+ // Cleanup the PreRead field trial registry key.
+ // TODO(fdoray): Remove this when M56 hits stable.
+ const base::string16 pre_read_field_trial_registry_path =
robliao 2016/09/30 01:10:09 Can this be done in a separate CL?
fdoray 2016/09/30 12:36:41 Done. Made the CL smaller.
+ BrowserDistribution::GetDistribution()->GetRegistryPath() +
+ L"\\PreReadFieldTrial";
+ base::win::RegKey(HKEY_CURRENT_USER,
+ pre_read_field_trial_registry_path.c_str(), KEY_SET_VALUE)
+ .DeleteKey(L"");
+#endif // defined(OS_WIN)
+
// At this point, StartupBrowserCreator::Start has run creating initial
// browser windows and tabs, but no progress has been made in loading
// content as the main message loop hasn't started processing tasks yet.
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698