OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_TASK_SCHEDULER_UTILS_H_ | |
6 #define BASE_TASK_SCHEDULER_UTILS_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/base_export.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/task_scheduler/sequence.h" | |
13 #include "base/task_scheduler/task.h" | |
14 | |
15 namespace base { | |
16 namespace internal { | |
17 | |
18 class DelayedTaskManager; | |
19 class PriorityQueue; | |
20 class SchedulerTaskExecutor; | |
21 class TaskTracker; | |
22 | |
23 // Attempts to post |task| to the provided |sequence| and |executor| conditional | |
24 // on |task_tracker|. If |task| has a delayed run time, it is handled by | |
25 // |delayed_task_manager|. Returns true if the task is posted. | |
26 bool BASE_EXPORT PostTaskToExecutor(std::unique_ptr<Task> task, | |
27 scoped_refptr<Sequence> sequence, | |
28 SchedulerTaskExecutor* executor, | |
29 TaskTracker* task_tracker, | |
30 DelayedTaskManager* delayed_task_manager); | |
31 | |
32 // Posts |task| to the provided |sequence| and |priority_queue|. This must only | |
33 // be called after |task|'s delayed run time. Returns true if |sequence| was | |
34 // empty before |task| was inserted into it. | |
35 bool BASE_EXPORT | |
36 AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task, | |
37 scoped_refptr<Sequence> sequence, | |
38 PriorityQueue* priority_queue); | |
39 | |
40 } // namespace internal | |
41 } // namespace base | |
42 | |
43 #endif // BASE_TASK_SCHEDULER_UTILS_H_ | |
OLD | NEW |