| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // this. CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler | 138 // this. CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler |
| 139 // (ensures isolation). | 139 // (ensures isolation). |
| 140 static void CreateAndSetSimpleTaskScheduler(StringPiece name); | 140 static void CreateAndSetSimpleTaskScheduler(StringPiece name); |
| 141 #endif // !defined(OS_NACL) | 141 #endif // !defined(OS_NACL) |
| 142 | 142 |
| 143 // Creates and sets a task scheduler using custom params. |name| is used to | 143 // Creates and sets a task scheduler using custom params. |name| is used to |
| 144 // label threads and histograms. It should identify the component that creates | 144 // label threads and histograms. It should identify the component that creates |
| 145 // the TaskScheduler. |init_params| is used to initialize the worker pools. | 145 // the TaskScheduler. |init_params| is used to initialize the worker pools. |
| 146 // CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler | 146 // CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler |
| 147 // (ensures isolation). | 147 // (ensures isolation). |
| 148 // | |
| 149 // Note: The names and priority hints in |init_params| are ignored (ref. TODO | |
| 150 // to remove them). | |
| 151 static void CreateAndSetDefaultTaskScheduler(StringPiece name, | 148 static void CreateAndSetDefaultTaskScheduler(StringPiece name, |
| 152 const InitParams& init_params); | 149 const InitParams& init_params); |
| 153 | 150 |
| 154 // Registers |task_scheduler| to handle tasks posted through the post_task.h | 151 // Registers |task_scheduler| to handle tasks posted through the post_task.h |
| 155 // API for this process. For tests, prefer base::test::ScopedTaskScheduler | 152 // API for this process. For tests, prefer base::test::ScopedTaskScheduler |
| 156 // (ensures isolation). | 153 // (ensures isolation). |
| 157 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler); | 154 static void SetInstance(std::unique_ptr<TaskScheduler> task_scheduler); |
| 158 | 155 |
| 159 // Retrieve the TaskScheduler set via SetInstance() or | 156 // Retrieve the TaskScheduler set via SetInstance() or |
| 160 // CreateAndSet(Simple|Default)TaskScheduler(). This should be used very | 157 // CreateAndSet(Simple|Default)TaskScheduler(). This should be used very |
| (...skipping 19 matching lines...) Expand all Loading... |
| 180 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. | 177 // each process n/GetMaxConcurrentTasksWithTraitsDeprecated() items. |
| 181 // | 178 // |
| 182 // TODO(fdoray): Remove this method. https://crbug.com/687264 | 179 // TODO(fdoray): Remove this method. https://crbug.com/687264 |
| 183 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( | 180 virtual int GetMaxConcurrentTasksWithTraitsDeprecated( |
| 184 const TaskTraits& traits) const = 0; | 181 const TaskTraits& traits) const = 0; |
| 185 }; | 182 }; |
| 186 | 183 |
| 187 } // namespace base | 184 } // namespace base |
| 188 | 185 |
| 189 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ | 186 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_H_ |
| OLD | NEW |