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 // Helper for posting a task to the provided |sequence| and |executor| |
| 29 // conditional on |task_tracker|. Returns true if the task is posted. |
| 30 bool BASE_EXPORT PostTaskHelper(const tracked_objects::Location& posted_from, |
| 31 const Closure& closure, |
| 32 const TaskTraits& traits, |
| 33 const TimeDelta& delay, |
| 34 scoped_refptr<Sequence> sequence, |
| 35 SchedulerTaskExecutor* executor, |
| 36 TaskTracker* task_tracker); |
| 37 |
| 38 // Helper for posting |task| to the provided |sequence| and |priority_queue|. |
| 39 // This must only be called after |task|'s delayed run time. Returns true if |
| 40 // |sequence| was empty before |task| was inserted into it. |
| 41 bool BASE_EXPORT PostTaskWithSequenceHelper(std::unique_ptr<Task> task, |
| 42 scoped_refptr<Sequence> sequence, |
| 43 PriorityQueue* priority_queue); |
| 44 |
| 45 } // namespace internal |
| 46 } // namespace base |
| 47 |
| 48 #endif // BASE_TASK_SCHEDULER_UTILS_H_ |
OLD | NEW |