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 #include "base/task_scheduler/scheduler_worker_thread.h" | 5 #include "base/task_scheduler/scheduler_worker_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); | 40 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); |
41 should_exit_for_testing_ = true; | 41 should_exit_for_testing_ = true; |
42 } | 42 } |
43 WakeUp(); | 43 WakeUp(); |
44 PlatformThread::Join(thread_handle_); | 44 PlatformThread::Join(thread_handle_); |
45 } | 45 } |
46 | 46 |
47 SchedulerWorkerThread::SchedulerWorkerThread(ThreadPriority thread_priority, | 47 SchedulerWorkerThread::SchedulerWorkerThread(ThreadPriority thread_priority, |
48 std::unique_ptr<Delegate> delegate, | 48 std::unique_ptr<Delegate> delegate, |
49 TaskTracker* task_tracker) | 49 TaskTracker* task_tracker) |
50 : wake_up_event_(false, false), | 50 : wake_up_event_(WaitableEvent::ResetPolicy::AUTOMATIC, |
| 51 WaitableEvent::InitialState::NOT_SIGNALED), |
51 delegate_(std::move(delegate)), | 52 delegate_(std::move(delegate)), |
52 task_tracker_(task_tracker) { | 53 task_tracker_(task_tracker) { |
53 DCHECK(delegate_); | 54 DCHECK(delegate_); |
54 DCHECK(task_tracker_); | 55 DCHECK(task_tracker_); |
55 | 56 |
56 const size_t kDefaultStackSize = 0; | 57 const size_t kDefaultStackSize = 0; |
57 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_, | 58 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_, |
58 thread_priority); | 59 thread_priority); |
59 } | 60 } |
60 | 61 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 102 } |
102 } | 103 } |
103 | 104 |
104 bool SchedulerWorkerThread::ShouldExitForTesting() const { | 105 bool SchedulerWorkerThread::ShouldExitForTesting() const { |
105 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); | 106 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); |
106 return should_exit_for_testing_; | 107 return should_exit_for_testing_; |
107 } | 108 } |
108 | 109 |
109 } // namespace internal | 110 } // namespace internal |
110 } // namespace base | 111 } // namespace base |
OLD | NEW |