Chromium Code Reviews| Index: base/task_scheduler/task.h |
| diff --git a/base/task_scheduler/task.h b/base/task_scheduler/task.h |
| index 010b29d830adcacfad4408798c72abb61f2f6205..2615c32ace62f97919f6c3a40ba8d57ac255ee9c 100644 |
| --- a/base/task_scheduler/task.h |
| +++ b/base/task_scheduler/task.h |
| @@ -8,7 +8,11 @@ |
| #include "base/base_export.h" |
| #include "base/callback_forward.h" |
| #include "base/location.h" |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| #include "base/pending_task.h" |
| +#include "base/sequenced_task_runner.h" |
| +#include "base/single_thread_task_runner.h" |
| #include "base/task_scheduler/task_traits.h" |
| #include "base/time/time.h" |
| @@ -35,6 +39,23 @@ struct BASE_EXPORT Task : public PendingTask { |
| // time after the task's delay has expired. If the task hasn't been inserted |
| // in a sequence yet, this defaults to a null TimeTicks. |
| TimeTicks sequenced_time; |
| + |
| + // A reference to the SequencedTaskRunner or SingleThreadedTaskRunner that |
|
fdoray
2016/04/27 18:11:20
SingleThreadTaskRunner
^
https://code.
gab
2016/04/27 20:21:40
Done.
|
| + // posted this task, if any. Used to set ThreadTaskRunnerHandle and/or |
| + // SequencedTaskRunnerHandle while the task is running. |
| + // Note: this creates an ownership cycle |
| + // Sequence -> Task -> TaskRunner -> Sequence -> ... |
| + // but that's okay as it's broken when the Task is popped from its Sequence |
| + // after being executed which means this cycle forces the TaskRunner to stick |
| + // around until all its tasks have been executed which is a requirement to |
| + // support ThreadTaskRunnerHandles. |
|
fdoray
2016/04/27 18:11:20
s/ThreadTaskRunnerHandles/TaskRunnerHandles/ ?
gab
2016/04/27 20:21:40
Done.
|
| + scoped_refptr<SequencedTaskRunner> sequenced_task_runner_ref; |
| + scoped_refptr<SingleThreadTaskRunner> single_thread_task_runner_ref; |
| + |
| + private: |
| + // Disallow copies to make sure no unecessary ref-bumps are incurred. Making |
|
fdoray
2016/04/27 18:11:20
unnecessary
^
gab
2016/04/27 20:21:40
Done.
|
| + // it move-only would be an option, but isn't necessary for now. |
| + DISALLOW_COPY_AND_ASSIGN(Task); |
| }; |
| } // namespace internal |