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