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_THREAD_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 static std::unique_ptr<SchedulerWorkerThread> Create( | 56 static std::unique_ptr<SchedulerWorkerThread> Create( |
57 ThreadPriority thread_priority, | 57 ThreadPriority thread_priority, |
58 std::unique_ptr<Delegate> delegate, | 58 std::unique_ptr<Delegate> delegate, |
59 TaskTracker* task_tracker); | 59 TaskTracker* task_tracker); |
60 | 60 |
61 // Destroying a SchedulerWorkerThread in production is not allowed; it is | 61 // Destroying a SchedulerWorkerThread in production is not allowed; it is |
62 // always leaked. In tests, it can only be destroyed after JoinForTesting() | 62 // always leaked. In tests, it can only be destroyed after JoinForTesting() |
63 // has returned. | 63 // has returned. |
64 ~SchedulerWorkerThread() override; | 64 ~SchedulerWorkerThread() override; |
65 | 65 |
| 66 const char* GetThreadName() const; |
| 67 |
66 // Wakes up this SchedulerWorkerThread if it wasn't already awake. After this | 68 // Wakes up this SchedulerWorkerThread if it wasn't already awake. After this |
67 // is called, this SchedulerWorkerThread will run Tasks from Sequences | 69 // is called, this SchedulerWorkerThread will run Tasks from Sequences |
68 // returned by the GetWork() method of its delegate until it returns nullptr. | 70 // returned by the GetWork() method of its delegate until it returns nullptr. |
69 void WakeUp(); | 71 void WakeUp(); |
70 | 72 |
71 SchedulerWorkerThread::Delegate* delegate() { return delegate_.get(); } | 73 SchedulerWorkerThread::Delegate* delegate() { return delegate_.get(); } |
72 | 74 |
73 // Joins this SchedulerWorkerThread. If a Task is already running, it will be | 75 // Joins this SchedulerWorkerThread. If a Task is already running, it will be |
74 // allowed to complete its execution. This can only be called once. | 76 // allowed to complete its execution. This can only be called once. |
75 void JoinForTesting(); | 77 void JoinForTesting(); |
(...skipping 23 matching lines...) Expand all Loading... |
99 // True once JoinForTesting() has been called. | 101 // True once JoinForTesting() has been called. |
100 bool should_exit_for_testing_ = false; | 102 bool should_exit_for_testing_ = false; |
101 | 103 |
102 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); | 104 DISALLOW_COPY_AND_ASSIGN(SchedulerWorkerThread); |
103 }; | 105 }; |
104 | 106 |
105 } // namespace internal | 107 } // namespace internal |
106 } // namespace base | 108 } // namespace base |
107 | 109 |
108 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ | 110 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_THREAD_H_ |
OLD | NEW |