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

Unified Diff: content/browser/browser_main_loop.cc

Issue 2835933004: Create TaskScheduler in BrowserMainLoop constructor. (Closed)
Patch Set: CR-robliao-9 Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index c9828a57bff423c29ef73f368e73877efb9292e4..b024d9fc7fee9e5b5d2526a2c8c5017db6a3d118 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -531,6 +531,10 @@ BrowserMainLoop::BrowserMainLoop(const MainFunctionParams& parameters)
tracing::TraceConfigFile::GetInstance()->GetStartupDuration() > 0)) {
DCHECK(!g_current_browser_main_loop);
g_current_browser_main_loop = this;
+
+ // Use an empty string as TaskScheduler name to match the suffix of browser
+ // process TaskScheduler histograms.
+ base::TaskScheduler::Create("");
}
BrowserMainLoop::~BrowserMainLoop() {
@@ -951,14 +955,15 @@ void BrowserMainLoop::CreateStartupTasks() {
int BrowserMainLoop::CreateThreads() {
TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads");
- auto task_scheduler_init_params =
- GetContentClient()->browser()->GetTaskSchedulerInitParams();
- if (!task_scheduler_init_params)
- task_scheduler_init_params = GetDefaultTaskSchedulerInitParams();
- DCHECK(task_scheduler_init_params);
-
- base::TaskScheduler::CreateAndSetDefaultTaskScheduler(
- "", *task_scheduler_init_params.get());
+ {
+ auto task_scheduler_init_params =
+ GetContentClient()->browser()->GetTaskSchedulerInitParams();
+ if (!task_scheduler_init_params)
+ task_scheduler_init_params = GetDefaultTaskSchedulerInitParams();
+ DCHECK(task_scheduler_init_params);
+ base::TaskScheduler::GetInstance()->Start(
+ *task_scheduler_init_params.get());
+ }
GetContentClient()->browser()->PerformExperimentalTaskSchedulerRedirections();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698