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_POOL_H_ | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_H_ |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_H_ | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // be used to put |sequence| back into a queue after running a Task from it. | 36 // be used to put |sequence| back into a queue after running a Task from it. |
37 // The thread that calls this doesn't have to belong to this | 37 // The thread that calls this doesn't have to belong to this |
38 // SchedulerWorkerPool. | 38 // SchedulerWorkerPool. |
39 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence, | 39 virtual void ReEnqueueSequence(scoped_refptr<Sequence> sequence, |
40 const SequenceSortKey& sequence_sort_key) = 0; | 40 const SequenceSortKey& sequence_sort_key) = 0; |
41 | 41 |
42 // Posts |task| to be executed by this SchedulerWorkerPool as part of | 42 // Posts |task| to be executed by this SchedulerWorkerPool as part of |
43 // |sequence|. If |worker| is non-null, |task| will be scheduled to run on it | 43 // |sequence|. If |worker| is non-null, |task| will be scheduled to run on it |
44 // specifically (note: |worker| must be owned by this SchedulerWorkerPool); | 44 // specifically (note: |worker| must be owned by this SchedulerWorkerPool); |
45 // otherwise, |task| will be added to the pending shared work. |task| won't be | 45 // otherwise, |task| will be added to the pending shared work. |task| won't be |
46 // executed before its delayed run time, if any. Returns true if |task| is | 46 // executed before its |delay| expires. Returns true if |task| is posted. |
47 // posted. | |
48 virtual bool PostTaskWithSequence(std::unique_ptr<Task> task, | 47 virtual bool PostTaskWithSequence(std::unique_ptr<Task> task, |
49 scoped_refptr<Sequence> sequence, | 48 scoped_refptr<Sequence> sequence, |
50 SchedulerWorker* worker) = 0; | 49 SchedulerWorker* worker, |
| 50 TimeDelta delay) = 0; |
51 | 51 |
52 // Posts |task| to be executed by this SchedulerWorkerPool as part of | 52 // Posts |task| to be executed by this SchedulerWorkerPool as part of |
53 // |sequence|. If |worker| is non-null, |task| will be scheduled to run on it | 53 // |sequence|. If |worker| is non-null, |task| will be scheduled to run on it |
54 // specifically (note: |worker| must be owned by this SchedulerWorkerPool); | 54 // specifically (note: |worker| must be owned by this SchedulerWorkerPool); |
55 // otherwise, |task| will be added to the pending shared work. This must only | 55 // otherwise, |task| will be added to the pending shared work. This must only |
56 // be called after |task| has gone through PostTaskWithSequence() and after | 56 // be called after |task| has gone through PostTaskWithSequence() and after |
57 // |task|'s delayed run time. | 57 // |task|'s delayed run time. |
58 virtual void PostTaskWithSequenceNow(std::unique_ptr<Task> task, | 58 virtual void PostTaskWithSequenceNow(std::unique_ptr<Task> task, |
59 scoped_refptr<Sequence> sequence, | 59 scoped_refptr<Sequence> sequence, |
60 SchedulerWorker* worker) = 0; | 60 SchedulerWorker* worker) = 0; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace internal | 63 } // namespace internal |
64 } // namespace base | 64 } // namespace base |
65 | 65 |
66 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_H_ | 66 #endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_POOL_H_ |
OLD | NEW |