Index: base/task_scheduler/utils.h |
diff --git a/base/task_scheduler/utils.h b/base/task_scheduler/utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fbfea9e37b8e25f5b70402f7a4e46fde4048ab14 |
--- /dev/null |
+++ b/base/task_scheduler/utils.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_TASK_SCHEDULER_UTILS_H_ |
+#define BASE_TASK_SCHEDULER_UTILS_H_ |
+ |
+#include <memory> |
+ |
+#include "base/base_export.h" |
+#include "base/callback_forward.h" |
+#include "base/location.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/task_scheduler/sequence.h" |
+#include "base/task_scheduler/task.h" |
+ |
+namespace base { |
+ |
+class TaskTraits; |
+class TimeDelta; |
+ |
+namespace internal { |
+ |
+class PriorityQueue; |
+class SchedulerTaskExecutor; |
+class TaskTracker; |
+ |
+// Helper for posting a task to the provided |sequence| and |executor| |
danakj
2016/04/14 19:48:58
"Helper for posting" -> "Attempts to post"
fdoray
2016/04/14 23:46:58
Done.
|
+// conditional on |task_tracker|. Returns true if the task is posted. |
+bool BASE_EXPORT PostTaskHelper(const tracked_objects::Location& posted_from, |
danakj
2016/04/14 19:48:58
Can you name this more descriptively based on what
fdoray
2016/04/14 23:46:58
Done. Renamed it PostTaskToExecutor.
|
+ const Closure& closure, |
+ const TaskTraits& traits, |
+ const TimeDelta& delay, |
+ scoped_refptr<Sequence> sequence, |
+ SchedulerTaskExecutor* executor, |
+ TaskTracker* task_tracker); |
+ |
+// Helper for posting |task| to the provided |sequence| and |priority_queue|. |
danakj
2016/04/14 19:48:58
ditto
fdoray
2016/04/14 23:46:58
Done.
|
+// Returns true if |sequence| was empty before |task| was inserted into it. |
+bool BASE_EXPORT PostTaskNowHelper(std::unique_ptr<Task> task, |
danakj
2016/04/14 19:48:58
Ditto, "Helper" is not helpful in telling me what
fdoray
2016/04/14 23:46:58
Done.
|
+ scoped_refptr<Sequence> sequence, |
+ PriorityQueue* priority_queue); |
+ |
+} // namespace internal |
+} // namespace base |
+ |
+#endif // BASE_TASK_SCHEDULER_UTILS_H_ |