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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 SchedulerWorkerThread::SchedulerWorkerThread( | 48 SchedulerWorkerThread::SchedulerWorkerThread( |
49 ThreadPriority thread_priority, | 49 ThreadPriority thread_priority, |
50 SchedulerWorkerThreadDelegate* delegate, | 50 SchedulerWorkerThreadDelegate* delegate, |
51 TaskTracker* task_tracker) | 51 TaskTracker* task_tracker) |
52 : wake_up_event_(false, false), | 52 : wake_up_event_(false, false), |
53 delegate_(delegate), | 53 delegate_(delegate), |
54 task_tracker_(task_tracker) { | 54 task_tracker_(task_tracker) { |
55 DCHECK(delegate_); | 55 DCHECK(delegate_); |
56 DCHECK(task_tracker_); | 56 DCHECK(task_tracker_); |
57 | 57 |
58 static const size_t kDefaultStackSize = 0; | 58 const size_t kDefaultStackSize = 0; |
59 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_, | 59 PlatformThread::CreateWithPriority(kDefaultStackSize, this, &thread_handle_, |
60 thread_priority); | 60 thread_priority); |
61 } | 61 } |
62 | 62 |
63 void SchedulerWorkerThread::ThreadMain() { | 63 void SchedulerWorkerThread::ThreadMain() { |
64 delegate_->OnMainEntry(); | 64 delegate_->OnMainEntry(); |
65 | 65 |
66 // A SchedulerWorkerThread starts out sleeping. | 66 // A SchedulerWorkerThread starts out sleeping. |
67 wake_up_event_.Wait(); | 67 wake_up_event_.Wait(); |
68 | 68 |
(...skipping 20 matching lines...) Expand all Loading... |
89 delegate_->OnMainExit(); | 89 delegate_->OnMainExit(); |
90 } | 90 } |
91 | 91 |
92 bool SchedulerWorkerThread::ShouldExitForTesting() const { | 92 bool SchedulerWorkerThread::ShouldExitForTesting() const { |
93 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); | 93 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); |
94 return should_exit_for_testing_; | 94 return should_exit_for_testing_; |
95 } | 95 } |
96 | 96 |
97 } // namespace internal | 97 } // namespace internal |
98 } // namespace base | 98 } // namespace base |
OLD | NEW |