Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: base/task_scheduler/scheduler_worker.h

Issue 2399213005: TaskScheduler: Change Sequence::PeekTask to Sequence::TakeTask. (Closed)
Patch Set: CR robliao #5 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // If a thread is recreated after detachment, |detach_duration| is the time 46 // If a thread is recreated after detachment, |detach_duration| is the time
47 // elapsed since detachment. Otherwise, if this is the first thread created 47 // elapsed since detachment. Otherwise, if this is the first thread created
48 // for |worker|, |detach_duration| is TimeDelta::Max(). 48 // for |worker|, |detach_duration| is TimeDelta::Max().
49 virtual void OnMainEntry(SchedulerWorker* worker, 49 virtual void OnMainEntry(SchedulerWorker* worker,
50 const TimeDelta& detach_duration) = 0; 50 const TimeDelta& detach_duration) = 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 |task|. |task_latency| is the 56 // Called by the SchedulerWorker after it ran a task with |task_priority|.
57 // time elapsed between when the task was posted and when it started to run. 57 // |task_latency| is the time elapsed between when the task was posted and
58 virtual void DidRunTask(const Task* task, 58 // when it started to run.
59 const TimeDelta& task_latency) = 0; 59 virtual void DidRunTaskWithPriority(TaskPriority task_priority,
60 const TimeDelta& task_latency) = 0;
60 61
61 // 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
62 // from it. |sequence| is the last Sequence returned by GetWork(). 63 // from it. |sequence| is the last Sequence returned by GetWork().
63 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0; 64 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence) = 0;
64 65
65 // 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
66 // GetWork(). GetWork() may be called before this timeout expires if the 67 // GetWork(). GetWork() may be called before this timeout expires if the
67 // worker's WakeUp() method is called. 68 // worker's WakeUp() method is called.
68 virtual TimeDelta GetSleepTimeout() = 0; 69 virtual TimeDelta GetSleepTimeout() = 0;
69 70
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // True once JoinForTesting() has been called. 158 // True once JoinForTesting() has been called.
158 bool should_exit_for_testing_ = false; 159 bool should_exit_for_testing_ = false;
159 160
160 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker); 161 DISALLOW_COPY_AND_ASSIGN(SchedulerWorker);
161 }; 162 };
162 163
163 } // namespace internal 164 } // namespace internal
164 } // namespace base 165 } // namespace base
165 166
166 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_ 167 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_service_thread.cc ('k') | base/task_scheduler/scheduler_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698