Chromium Code Reviews| Index: base/task_scheduler/delayed_task_manager.h |
| diff --git a/base/task_scheduler/delayed_task_manager.h b/base/task_scheduler/delayed_task_manager.h |
| index 3bfb355ef6dc0e31d2f7c1d9be4e45f94d7c41fe..8785f768b6048c7e6c8f24fb7230c80695516f10 100644 |
| --- a/base/task_scheduler/delayed_task_manager.h |
| +++ b/base/task_scheduler/delayed_task_manager.h |
| @@ -8,6 +8,7 @@ |
| #include <memory> |
| #include "base/base_export.h" |
| +#include "base/callback_forward.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/time/time.h" |
|
fdoray
2017/02/10 13:04:06
Remove this include.
robliao
2017/02/10 18:13:57
Done.
|
| @@ -18,32 +19,25 @@ class TaskRunner; |
| namespace internal { |
| -class SchedulerWorker; |
| -class SchedulerWorkerPool; |
| -class Sequence; |
| struct Task; |
| -// A DelayedTaskManager forwards Tasks to a SchedulerWorkerPool when they become |
| -// ripe for execution. This class is thread-safe. |
| +// The DelayedTaskManager forwards tasks to various scheduler components when |
| +// they become ripe for execution. This class is thread-safe. |
| class BASE_EXPORT DelayedTaskManager { |
| public: |
| + // Posts |task| for execution immediately. |
| + using PostTaskNowCallback = Callback<void(std::unique_ptr<Task> task)>; |
| + |
| // |service_thread_task_runner| posts tasks to the TaskScheduler service |
| // thread. |
| explicit DelayedTaskManager( |
| scoped_refptr<TaskRunner> service_thread_task_runner); |
| ~DelayedTaskManager(); |
| - // Posts |task|. The task will be forwarded to |worker_pool| with |sequence| |
| - // and |worker| when it becomes ripe for execution. |worker| is a |
| - // SchedulerWorker owned by |worker_pool| or nullptr. |
| - // |
| - // TODO(robliao): Find a concrete way to manage the memory of |worker| and |
| - // |worker_pool|. These objects are never deleted in production, but it is |
| - // better not to spread this assumption throughout the scheduler. |
| + // Calls |post_task_now_callback| with |task| when |task| is ripe for |
| + // execution. |
| void AddDelayedTask(std::unique_ptr<Task> task, |
| - scoped_refptr<Sequence> sequence, |
| - SchedulerWorker* worker, |
| - SchedulerWorkerPool* worker_pool); |
| + const PostTaskNowCallback& post_task_now_callback); |
| private: |
| const scoped_refptr<TaskRunner> service_thread_task_runner_; |