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

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: remove unused "using" Created 4 years, 5 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"
9 8
10 namespace base { 9 namespace base {
11 10
12 namespace { 11 namespace {
13 12
14 // |g_task_scheduler| is intentionally leaked on shutdown. 13 // |g_task_scheduler| is intentionally leaked on shutdown.
15 TaskScheduler* g_task_scheduler = nullptr; 14 TaskScheduler* g_task_scheduler = nullptr;
16 15
17 } // namespace 16 } // namespace
18 17
19 // static 18 // static
20 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) { 19 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) {
21 delete g_task_scheduler; 20 delete g_task_scheduler;
22 g_task_scheduler = task_scheduler.release(); 21 g_task_scheduler = task_scheduler.release();
23 } 22 }
24 23
25 // static 24 // static
26 void TaskScheduler::InitializeDefaultTaskScheduler() {
27 SetInstance(internal::TaskSchedulerImpl::Create());
28 }
29
30 // static
31 TaskScheduler* TaskScheduler::GetInstance() { 25 TaskScheduler* TaskScheduler::GetInstance() {
32 return g_task_scheduler; 26 return g_task_scheduler;
33 } 27 }
34 28
35 } // namespace base 29 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698