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_SCHEDULER_WORKER_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/atomic_flag.h" | 13 #include "base/synchronization/atomic_flag.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "base/task_scheduler/scheduler_lock.h" | 15 #include "base/task_scheduler/scheduler_lock.h" |
16 #include "base/task_scheduler/scheduler_worker_params.h" | 16 #include "base/task_scheduler/scheduler_worker_params.h" |
17 #include "base/task_scheduler/sequence.h" | 17 #include "base/task_scheduler/sequence.h" |
18 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 | 21 |
| 22 #if defined(OS_WIN) |
| 23 #include "base/win/com_init_check_hook.h" |
| 24 #endif |
| 25 |
22 namespace base { | 26 namespace base { |
23 namespace internal { | 27 namespace internal { |
24 | 28 |
25 class TaskTracker; | 29 class TaskTracker; |
26 | 30 |
27 // A worker that manages a single thread to run Tasks from Sequences returned | 31 // A worker that manages a single thread to run Tasks from Sequences returned |
28 // by a delegate. | 32 // by a delegate. |
29 // | 33 // |
30 // A SchedulerWorker starts out sleeping. It is woken up by a call to WakeUp(). | 34 // A SchedulerWorker starts out sleeping. It is woken up by a call to WakeUp(). |
31 // After a wake-up, a SchedulerWorker runs Tasks from Sequences returned by the | 35 // After a wake-up, a SchedulerWorker runs Tasks from Sequences returned by the |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 std::unique_ptr<Thread> thread_; | 192 std::unique_ptr<Thread> thread_; |
189 | 193 |
190 bool started_ = false; | 194 bool started_ = false; |
191 AtomicFlag should_exit_; | 195 AtomicFlag should_exit_; |
192 | 196 |
193 const ThreadPriority priority_hint_; | 197 const ThreadPriority priority_hint_; |
194 | 198 |
195 const std::unique_ptr<Delegate> delegate_; | 199 const std::unique_ptr<Delegate> delegate_; |
196 TaskTracker* const task_tracker_; | 200 TaskTracker* const task_tracker_; |
197 | 201 |
198 #if defined(OS_WIN) | 202 #if defined(OS_WIN) && !defined(COM_INIT_CHECK_HOOK_ENABLED) |
199 const SchedulerBackwardCompatibility backward_compatibility_; | 203 const SchedulerBackwardCompatibility backward_compatibility_; |
200 #endif | 204 #endif |
201 | 205 |
202 const InitialState initial_state_; | 206 const InitialState initial_state_; |
203 | 207 |
204 // Set once JoinForTesting() has been called. | 208 // Set once JoinForTesting() has been called. |
205 AtomicFlag join_called_for_testing_; | 209 AtomicFlag join_called_for_testing_; |
206 | 210 |
207 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker); | 211 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker); |
208 }; | 212 }; |
209 | 213 |
210 } // namespace internal | 214 } // namespace internal |
211 } // namespace base | 215 } // namespace base |
212 | 216 |
213 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ | 217 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ |
OLD | NEW |