OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_TASK_SCHEDULER_TASK_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_H_ |
6 #define BASE_TASK_SCHEDULER_TASK_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/pending_task.h" | 11 #include "base/pending_task.h" |
12 #include "base/task_scheduler/task_traits.h" | 12 #include "base/task_scheduler/task_traits.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 // A task is a unit of work inside the task scheduler. Support for tracing and | 18 // A task is a unit of work inside the task scheduler. Support for tracing and |
19 // profiling inherited from PendingTask. | 19 // profiling inherited from PendingTask. |
20 struct BASE_EXPORT Task : public PendingTask { | 20 struct BASE_EXPORT Task : public PendingTask { |
21 // |posted_from| is the site the task was posted from. |task| is the closure | 21 // |posted_from| is the site the task was posted from. |task| is the closure |
22 // to run. |traits| is metadata about the task. |delayed_run_time| is the time | 22 // to run. |traits| is metadata about the task. |delay| is a delay that must |
23 // at which the task should be run (null TimeTicks if the task can run | 23 // expire before the Task runs. |
24 // immediately). | |
25 Task(const tracked_objects::Location& posted_from, | 24 Task(const tracked_objects::Location& posted_from, |
26 const Closure& task, | 25 const Closure& task, |
27 const TaskTraits& traits, | 26 const TaskTraits& traits, |
28 const TimeTicks& delayed_run_time); | 27 const TimeDelta& delay); |
29 ~Task(); | 28 ~Task(); |
30 | 29 |
31 // The TaskTraits of this task. | 30 // The TaskTraits of this task. |
32 const TaskTraits traits; | 31 const TaskTraits traits; |
33 | 32 |
34 // The time at which the task was inserted in its sequence. For an undelayed | 33 // The time at which the task was inserted in its sequence. For an undelayed |
35 // task, this happens at post time. For a delayed task, this happens some | 34 // task, this happens at post time. For a delayed task, this happens some |
36 // time after the task's delay has expired. If the task hasn't been inserted | 35 // time after the task's delay has expired. If the task hasn't been inserted |
37 // in a sequence yet, this defaults to a null TimeTicks. | 36 // in a sequence yet, this defaults to a null TimeTicks. |
38 TimeTicks sequenced_time; | 37 TimeTicks sequenced_time; |
39 }; | 38 }; |
40 | 39 |
41 } // namespace internal | 40 } // namespace internal |
42 } // namespace base | 41 } // namespace base |
43 | 42 |
44 #endif // BASE_TASK_SCHEDULER_TASK_H_ | 43 #endif // BASE_TASK_SCHEDULER_TASK_H_ |
OLD | NEW |