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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 75 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
76 const TaskTraits& traits, | 76 const TaskTraits& traits, |
77 ExecutionMode execution_mode) override; | 77 ExecutionMode execution_mode) override; |
78 void Shutdown() override; | 78 void Shutdown() override; |
79 | 79 |
80 // Joins all threads of this scheduler. Tasks that are already running are | 80 // Joins all threads of this scheduler. Tasks that are already running are |
81 // allowed to complete their execution. This can only be called once. | 81 // allowed to complete their execution. This can only be called once. |
82 void JoinForTesting(); | 82 void JoinForTesting(); |
83 | 83 |
84 private: | 84 private: |
85 TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& | 85 explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& |
86 worker_pool_index_for_traits_callback); | 86 worker_pool_index_for_traits_callback); |
87 | 87 |
88 void Initialize(const std::vector<WorkerPoolCreationArgs>& worker_pools); | 88 void Initialize(const std::vector<WorkerPoolCreationArgs>& worker_pools); |
89 | 89 |
90 // Returns the worker pool that runs Tasks with |traits|. | 90 // Returns the worker pool that runs Tasks with |traits|. |
91 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); | 91 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); |
92 | 92 |
93 // Callback invoked when a non-single-thread |sequence| isn't empty after a | 93 // Callback invoked when a non-single-thread |sequence| isn't empty after a |
94 // worker pops a Task from it. | 94 // worker pops a Task from it. |
95 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); | 95 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); |
96 | 96 |
(...skipping 12 matching lines...) Expand all Loading... |
109 WaitableEvent join_for_testing_returned_; | 109 WaitableEvent join_for_testing_returned_; |
110 #endif | 110 #endif |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 112 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace internal | 115 } // namespace internal |
116 } // namespace base | 116 } // namespace base |
117 | 117 |
118 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 118 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
OLD | NEW |