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_IMPL_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace internal { | 28 namespace internal { |
29 | 29 |
30 class DelayedTaskManager; | 30 class DelayedTaskManager; |
31 class SchedulerSingleThreadTaskRunnerManager; | 31 class SchedulerSingleThreadTaskRunnerManager; |
32 class TaskTracker; | 32 class TaskTracker; |
33 | 33 |
34 // Default TaskScheduler implementation. This class is thread-safe. | 34 // Default TaskScheduler implementation. This class is thread-safe. |
35 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { | 35 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { |
36 public: | 36 public: |
37 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. | 37 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. |
| 38 // |name| is used to label threads and histograms. It should identify the |
| 39 // component that creates the TaskScheduler. |init_params| contains params to |
| 40 // initialize worker pools. |
| 41 // |
| 42 // Note: The names and priority hints in |init_params| are ignored. |
| 43 // https://crbug.com/690706 |
| 44 static std::unique_ptr<TaskSchedulerImpl> Create( |
| 45 const std::string& name, |
| 46 const TaskScheduler::InitParams& init_params); |
| 47 |
| 48 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. |
38 // |worker_pool_params_vector| describes the worker pools to create. | 49 // |worker_pool_params_vector| describes the worker pools to create. |
39 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| | 50 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| |
40 // of the worker pool in which a task with given traits should run. | 51 // of the worker pool in which a task with given traits should run. |
| 52 // |
| 53 // Deprecated. https://crbug.com/690706 |
41 static std::unique_ptr<TaskSchedulerImpl> Create( | 54 static std::unique_ptr<TaskSchedulerImpl> Create( |
42 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector, | 55 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector, |
43 const WorkerPoolIndexForTraitsCallback& | 56 const WorkerPoolIndexForTraitsCallback& |
44 worker_pool_index_for_traits_callback); | 57 worker_pool_index_for_traits_callback); |
45 | 58 |
46 ~TaskSchedulerImpl() override; | 59 ~TaskSchedulerImpl() override; |
47 | 60 |
48 // TaskScheduler: | 61 // TaskScheduler: |
49 void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here, | 62 void PostDelayedTaskWithTraits(const tracked_objects::Location& from_here, |
50 const TaskTraits& traits, | 63 const TaskTraits& traits, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 AtomicFlag join_for_testing_returned_; | 104 AtomicFlag join_for_testing_returned_; |
92 #endif | 105 #endif |
93 | 106 |
94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 107 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
95 }; | 108 }; |
96 | 109 |
97 } // namespace internal | 110 } // namespace internal |
98 } // namespace base | 111 } // namespace base |
99 | 112 |
100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 113 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
OLD | NEW |