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/callback_forward.h" |
| 12 #include "base/location.h" |
| 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/task_scheduler/sequence.h" |
| 15 #include "base/task_scheduler/task.h" |
| 16 |
| 17 namespace base { |
| 18 |
| 19 class TaskTraits; |
| 20 class TimeDelta; |
| 21 |
| 22 namespace internal { |
| 23 |
| 24 class PriorityQueue; |
| 25 class SchedulerTaskExecutor; |
| 26 class TaskTracker; |
| 27 |
| 28 // Attempts to post a task to the provided |sequence| and |executor| conditional |
| 29 // on |task_tracker|. Returns true if the task is posted. |
| 30 bool BASE_EXPORT |
| 31 PostTaskToExecutor(const tracked_objects::Location& posted_from, |
| 32 const Closure& closure, |
| 33 const TaskTraits& traits, |
| 34 const TimeDelta& delay, |
| 35 scoped_refptr<Sequence> sequence, |
| 36 SchedulerTaskExecutor* executor, |
| 37 TaskTracker* task_tracker); |
| 38 |
| 39 // 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 |
| 41 // empty before |task| was inserted into it. |
| 42 bool BASE_EXPORT |
| 43 AddTaskToSequenceAndPriorityQueue(std::unique_ptr<Task> task, |
| 44 scoped_refptr<Sequence> sequence, |
| 45 PriorityQueue* priority_queue); |
| 46 |
| 47 } // namespace internal |
| 48 } // namespace base |
| 49 |
| 50 #endif // BASE_TASK_SCHEDULER_UTILS_H_ |
OLD | NEW |