Chromium Code Reviews| Index: content/browser/browser_main_loop.cc |
| diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
| index 14cfceeae7f49613657cddb059c059f7a0cdcad3..908aa07ac321349ecf371302f485ae188f4851ac 100644 |
| --- a/content/browser/browser_main_loop.cc |
| +++ b/content/browser/browser_main_loop.cc |
| @@ -31,6 +31,8 @@ |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_split.h" |
| #include "base/system_monitor/system_monitor.h" |
| +#include "base/task_scheduler/scheduler_worker_pool_params.h" |
| +#include "base/task_scheduler/task_scheduler.h" |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "base/threading/thread_restrictions.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| @@ -868,6 +870,17 @@ void BrowserMainLoop::CreateStartupTasks() { |
| int BrowserMainLoop::CreateThreads() { |
| TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads"); |
| + std::vector<base::SchedulerWorkerPoolParams> params_vector; |
| + base::TaskScheduler::WorkerPoolIndexForTraitsCallback |
| + index_to_traits_callback; |
| + GetContentClient()->browser()->GetTaskSchedulerInitializationParams( |
| + ¶ms_vector, &index_to_traits_callback); |
| + |
| + base::TaskScheduler::CreateAndSetDefaultTaskScheduler( |
| + params_vector, index_to_traits_callback); |
| + |
| + GetContentClient()->browser()->PerformRedirectionToTaskScheduler(); |
| + |
| base::Thread::Options io_message_loop_options; |
| io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| base::Thread::Options ui_message_loop_options; |
| @@ -1197,6 +1210,11 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| URLDataManager::DeleteDataSources(); |
| } |
| + { |
| + TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:TaskScheduler"); |
| + base::TaskScheduler::GetInstance()->Shutdown(); |
|
fdoray
2016/12/06 21:14:12
TaskScheduler is initialized just before browser t
robliao
2016/12/07 00:57:32
Looks like I was too aggressive with the lifetime
|
| + } |
| + |
| if (parts_) { |
| TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:PostDestroyThreads"); |
| parts_->PostDestroyThreads(); |