OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 kSuggestedReclaimTime}, | 64 kSuggestedReclaimTime}, |
65 {StandbyThreadPolicy::LAZY, kForegroundBlockingMaxThreads, | 65 {StandbyThreadPolicy::LAZY, kForegroundBlockingMaxThreads, |
66 kSuggestedReclaimTime}}); | 66 kSuggestedReclaimTime}}); |
67 } | 67 } |
68 #endif // !defined(OS_NACL) | 68 #endif // !defined(OS_NACL) |
69 | 69 |
70 void TaskScheduler::Create(StringPiece name) { | 70 void TaskScheduler::Create(StringPiece name) { |
71 SetInstance(MakeUnique<internal::TaskSchedulerImpl>(name)); | 71 SetInstance(MakeUnique<internal::TaskSchedulerImpl>(name)); |
72 } | 72 } |
73 | 73 |
74 void TaskScheduler::CreateAndSetDefaultTaskScheduler( | |
75 StringPiece name, | |
76 const InitParams& init_params) { | |
77 Create(name); | |
78 GetInstance()->Start(init_params); | |
79 } | |
80 | |
81 // static | 74 // static |
82 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) { | 75 void TaskScheduler::SetInstance(std::unique_ptr<TaskScheduler> task_scheduler) { |
83 delete g_task_scheduler; | 76 delete g_task_scheduler; |
84 g_task_scheduler = task_scheduler.release(); | 77 g_task_scheduler = task_scheduler.release(); |
85 } | 78 } |
86 | 79 |
87 // static | 80 // static |
88 TaskScheduler* TaskScheduler::GetInstance() { | 81 TaskScheduler* TaskScheduler::GetInstance() { |
89 return g_task_scheduler; | 82 return g_task_scheduler; |
90 } | 83 } |
91 | 84 |
92 } // namespace base | 85 } // namespace base |
OLD | NEW |