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 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // synchronization is required to use the post_task.h API after registering a | 150 // synchronization is required to use the post_task.h API after registering a |
151 // new TaskScheduler. | 151 // new TaskScheduler. |
152 | 152 |
153 #if !defined(OS_NACL) | 153 #if !defined(OS_NACL) |
154 // Creates and starts a task scheduler using default params. |name| is used to | 154 // Creates and starts a task scheduler using default params. |name| is used to |
155 // label threads and histograms. It should identify the component that calls | 155 // label threads and histograms. It should identify the component that calls |
156 // this. Start() is called by this method; it is invalid to call it again | 156 // this. Start() is called by this method; it is invalid to call it again |
157 // afterwards. CHECKs on failure. For tests, prefer | 157 // afterwards. CHECKs on failure. For tests, prefer |
158 // base::test::ScopedTaskEnvironment (ensures isolation). | 158 // base::test::ScopedTaskEnvironment (ensures isolation). |
159 static void CreateAndStartWithDefaultParams(StringPiece name); | 159 static void CreateAndStartWithDefaultParams(StringPiece name); |
160 | |
161 // Deprecated. Use CreateAndStartWithDefaultParams() instead. | |
162 // TODO(fdoray): Redirect callers to CreateAndStartWithDefaultParams(). | |
163 static void CreateAndSetSimpleTaskScheduler(StringPiece name); | |
164 #endif // !defined(OS_NACL) | 160 #endif // !defined(OS_NACL) |
165 | 161 |
166 // Creates a ready to start task scheduler. |name| is used to label threads | 162 // Creates a ready to start task scheduler. |name| is used to label threads |
167 // and histograms. It should identify the component that creates the | 163 // and histograms. It should identify the component that creates the |
168 // TaskScheduler. The task scheduler doesn't create threads until Start() is | 164 // TaskScheduler. The task scheduler doesn't create threads until Start() is |
169 // called. Tasks can be posted at any time but will not run until after | 165 // called. Tasks can be posted at any time but will not run until after |
170 // Start() is called. For tests, prefer base::test::ScopedTaskEnvironment | 166 // Start() is called. For tests, prefer base::test::ScopedTaskEnvironment |
171 // (ensures isolation). | 167 // (ensures isolation). |
172 static void Create(StringPiece name); | 168 static void Create(StringPiece name); |
173 | 169 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. | 201 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. |
206 // | 202 // |
207 // TODO(fdoray): Remove this method. https://crbug.com/687264 | 203 // TODO(fdoray): Remove this method. https://crbug.com/687264 |
208 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( | 204 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( |
209 const TaskTraits& traits) const = 0; | 205 const TaskTraits& traits) const = 0; |
210 }; | 206 }; |
211 | 207 |
212 } // namespace base | 208 } // namespace base |
213 | 209 |
214 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 210 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
OLD | NEW |