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 "base/base_export.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/task_scheduler/sequence.h" |
| 12 #include "base/task_scheduler/task.h" |
| 13 |
| 14 namespace base { |
| 15 namespace task_scheduler { |
| 16 |
| 17 class DelayedTaskManager; |
| 18 class PriorityQueue; |
| 19 class ShutdownManager; |
| 20 |
| 21 // Name used to annotate tasks posted to the task scheduler. |
| 22 // See task_annotator.h for more details. |
| 23 extern const char kQueueFunctionName[]; |
| 24 |
| 25 // Adds |task| to |delayed_task_manager| if it has a delayed run time. |
| 26 // Otherwise, calls PostTaskNowHelper(). |
| 27 void BASE_EXPORT PostTaskHelper(const Task& task, |
| 28 scoped_refptr<Sequence> sequence, |
| 29 PriorityQueue* priority_queue, |
| 30 ShutdownManager* shutdown_manager, |
| 31 DelayedTaskManager* delayed_task_manager); |
| 32 |
| 33 // Inserts |task| into |sequence|. Then, inserts |sequence| into |
| 34 // |priority_queue| if it was empty before |task| was inserted into it. |
| 35 // |shutdown_manager| is consulted to determine whether it is too late to post |
| 36 // the task. |
| 37 void BASE_EXPORT PostTaskNowHelper(const Task& task, |
| 38 scoped_refptr<Sequence> sequence, |
| 39 PriorityQueue* priority_queue, |
| 40 ShutdownManager* shutdown_manager); |
| 41 |
| 42 } // namespace task_scheduler |
| 43 } // namespace base |
| 44 |
| 45 #endif // BASE_TASK_SCHEDULER_UTILS_H_ |
OLD | NEW |