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

Side by Side Diff: base/task_scheduler/task_scheduler.cc

Issue 2064073003: TaskScheduler: Make the worker pools of TaskSchedulerImpl configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/task_scheduler/task_scheduler.h" 5 #include "base/task_scheduler/task_scheduler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/task_scheduler/task_scheduler_impl.h" 8 #include "base/task_scheduler/task_scheduler_impl.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 namespace { 12 namespace {
13 13
14 // |g_task_scheduler| is intentionally leaked on shutdown. 14 // |g_task_scheduler| is intentionally leaked on shutdown.
15 TaskScheduler* g_task_scheduler = nullptr; 15 TaskScheduler* g_task_scheduler = nullptr;
16 16
17 } // namespace 17 } // namespace
18 18
19 // static 19 // static
20 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) { 20 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) {
21 delete g_task_scheduler; 21 delete g_task_scheduler;
22 g_task_scheduler = task_scheduler.release(); 22 g_task_scheduler = task_scheduler.release();
23 } 23 }
24 24
25 // static 25 // static
26 void TaskScheduler::InitializeDefaultTaskScheduler() { 26 void TaskScheduler::InitializeDefaultTaskScheduler(
27 SetInstance(internal::TaskSchedulerImpl::Create()); 27 const std::map<std::string, std::string>& variation_params) {
28 SetInstance(internal::TaskSchedulerImpl::Create(variation_params));
28 } 29 }
29 30
30 // static 31 // static
31 TaskScheduler* TaskScheduler::GetInstance() { 32 TaskScheduler* TaskScheduler::GetInstance() {
32 return g_task_scheduler; 33 return g_task_scheduler;
33 } 34 }
34 35
35 } // namespace base 36 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698