| 6 | #define BASE_TASK_THREAD_POOL_TASK_H_ |
| 7 |
| 8 | #include "base/base_export.h" |
| 9 | #include "base/callback.h" |
| 10 | #include "base/location.h" |
| 11 | #include "base/macros.h" |
| 12 | #include "base/memory/ref_counted.h" |
| 13 | #include "base/pending_task.h" |
| 14 | #include "base/sequenced_task_runner.h" |
| 15 | #include "base/single_thread_task_runner.h" |
| 16 | #include "base/time/time.h" |
| 17 |
| 18 | namespace base { |
| 19 | namespace internal { |
| 20 |
| 21 | // A task is a unit of work inside the thread pool. Support for tracing and |
| 22 | // profiling inherited from PendingTask. |
| 23 | // TODO(etiennep): This class is now equivalent to PendingTask, remove it. |
| 24 | struct BASE_EXPORT Task : public PendingTask { |
| 25 | Task(); |
| 26 |
| 27 | // |posted_from| is the site the task was posted from. |task| is the closure |
| 28 | // to run. |delay| is a delay that must expire before the Task runs. |
| 29 | Task(const Location& posted_from, OnceClosure task, TimeDelta delay); |
| 30 |
| 31 | // Task is move-only to avoid mistakes that cause reference counts to be |
| 32 | // accidentally bumped. |
| 33 | Task(Task&& other) noexcept; |
| 34 |
| 35 | ~Task(); |
| 36 |
| 37 | Task& operator=(Task&& other); |
| 38 |
| 39 | private: |
| 40 | DISALLOW_COPY_AND_ASSIGN(Task); |
| 41 | }; |
| 42 |
| 43 | } // namespace internal |
| 44 | } // namespace base |
| 45 |
| 46 | #endif // BASE_TASK_THREAD_POOL_TASK_H_ |
| 47 |