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_UTILS_H_ | 5 #ifndef BASE_TASK_SCHEDULER_UTILS_H_ |
6 #define BASE_TASK_SCHEDULER_UTILS_H_ | 6 #define BASE_TASK_SCHEDULER_UTILS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/task_scheduler/sequence.h" | 14 #include "base/task_scheduler/sequence.h" |
15 #include "base/task_scheduler/task.h" | 15 #include "base/task_scheduler/task.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 | 18 |
19 class TaskTraits; | 19 class TaskTraits; |
20 class TimeDelta; | 20 class TimeDelta; |
21 | 21 |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
| 24 class DelayedTaskManager; |
24 class PriorityQueue; | 25 class PriorityQueue; |
25 class SchedulerTaskExecutor; | 26 class SchedulerTaskExecutor; |
26 class TaskTracker; | 27 class TaskTracker; |
27 | 28 |
28 // Attempts to post a task to the provided |sequence| and |executor| conditional | 29 // Attempts to post a task to the provided |sequence| and |executor| conditional |
29 // on |task_tracker|. Returns true if the task is posted. | 30 // on |task_tracker|. If |delay| is not zero, the task is handled by |
| 31 // |delayed_task_manager|. Returns true if the task is posted. |
30 bool BASE_EXPORT | 32 bool BASE_EXPORT |
31 PostTaskToExecutor(const tracked_objects::Location& posted_from, | 33 PostTaskToExecutor(const tracked_objects::Location& posted_from, |
32 const Closure& closure, | 34 const Closure& closure, |
33 const TaskTraits& traits, | 35 const TaskTraits& traits, |
34 const TimeDelta& delay, | 36 const TimeDelta& delay, |
35 scoped_refptr<Sequence> sequence, | 37 scoped_refptr<Sequence> sequence, |
36 SchedulerTaskExecutor* executor, | 38 SchedulerTaskExecutor* executor, |
37 TaskTracker* task_tracker); | 39 TaskTracker* task_tracker, |
| 40 DelayedTaskManager* delayed_task_manager); |
38 | 41 |
39 // Posts |task| to the provided |sequence| and |priority_queue|. This must only | 42 // Posts |task| to the provided |sequence| and |priority_queue|. This must only |
40 // be called after |task|'s delayed run time. Returns true if |sequence| was | 43 // be called after |task|'s delayed run time. Returns true if |sequence| was |
41 // empty before |task| was inserted into it. | 44 // empty before |task| was inserted into it. |
42 bool BASE_EXPORT | 45 bool BASE_EXPORT |
43 AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task, | 46 AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task, |
44 scoped_refptr<Sequence> sequence, | 47 scoped_refptr<Sequence> sequence, |
45 PriorityQueue* priority_queue); | 48 PriorityQueue* priority_queue); |
46 | 49 |
47 } // namespace internal | 50 } // namespace internal |
48 } // namespace base | 51 } // namespace base |
49 | 52 |
50 #endif // BASE_TASK_SCHEDULER_UTILS_H_ | 53 #endif // BASE_TASK_SCHEDULER_UTILS_H_ |
OLD | NEW |