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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual void OnMainEntry(SchedulerWorker* worker) = 0; | 50 virtual void OnMainEntry(SchedulerWorker* worker) = 0; |
51 | 51 |
52 // Called by a thread managed by |worker| to get a Sequence from which to | 52 // Called by a thread managed by |worker| to get a Sequence from which to |
53 // run a Task. | 53 // run a Task. |
54 virtual scoped_refptr<Sequence> GetWork(SchedulerWorker* worker) = 0; | 54 virtual scoped_refptr<Sequence> GetWork(SchedulerWorker* worker) = 0; |
55 | 55 |
56 // Called by the SchedulerWorker after it ran a task with |task_priority|. | 56 // Called by the SchedulerWorker after it ran a task with |task_priority|. |
57 // |task_latency| is the time elapsed between when the task was posted and | 57 // |task_latency| is the time elapsed between when the task was posted and |
58 // when it started to run. | 58 // when it started to run. |
59 virtual void DidRunTaskWithPriority(TaskPriority task_priority, | 59 virtual void DidRunTaskWithPriority(TaskPriority task_priority, |
60 const TimeDelta& task_latency) = 0; | 60 TimeDelta task_latency) = 0; |
61 | 61 |
62 // Called when |sequence| isn't empty after the SchedulerWorker pops a Task | 62 // Called when |sequence| isn't empty after the SchedulerWorker pops a Task |
63 // from it. |sequence| is the last Sequence returned by GetWork(). | 63 // from it. |sequence| is the last Sequence returned by GetWork(). |
64 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0; | 64 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0; |
65 | 65 |
66 // Called by a thread to determine how long to sleep before the next call to | 66 // Called by a thread to determine how long to sleep before the next call to |
67 // GetWork(). GetWork() may be called before this timeout expires if the | 67 // GetWork(). GetWork() may be called before this timeout expires if the |
68 // worker's WakeUp() method is called. | 68 // worker's WakeUp() method is called. |
69 virtual TimeDelta GetSleepTimeout() = 0; | 69 virtual TimeDelta GetSleepTimeout() = 0; |
70 | 70 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // Set once JoinForTesting() has been called. | 154 // Set once JoinForTesting() has been called. |
155 AtomicFlag should_exit_for_testing_; | 155 AtomicFlag should_exit_for_testing_; |
156 | 156 |
157 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker); | 157 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker); |
158 }; | 158 }; |
159 | 159 |
160 } // namespace internal | 160 } // namespace internal |
161 } // namespace base | 161 } // namespace base |
162 | 162 |
163 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ | 163 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ |
OLD | NEW |