Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: base/task_scheduler/task.h

Issue 2405243003: TaskScheduler: Replace the SchedulerServiceThread with a base::Thread. (Closed)
Patch Set: CR robliao #9 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 18 matching lines...) Expand all
29 // automatically adjusted to SKIP_ON_SHUTDOWN. 29 // automatically adjusted to SKIP_ON_SHUTDOWN.
30 Task(const tracked_objects::Location& posted_from, 30 Task(const tracked_objects::Location& posted_from,
31 const Closure& task, 31 const Closure& task,
32 const TaskTraits& traits, 32 const TaskTraits& traits,
33 const TimeDelta& delay); 33 const TimeDelta& delay);
34 ~Task(); 34 ~Task();
35 35
36 // The TaskTraits of this task. 36 // The TaskTraits of this task.
37 const TaskTraits traits; 37 const TaskTraits traits;
38 38
39 // The delay that must expire before the task runs.
40 const TimeDelta delay;
41
39 // The time at which the task was inserted in its sequence. For an undelayed 42 // The time at which the task was inserted in its sequence. For an undelayed
40 // task, this happens at post time. For a delayed task, this happens some 43 // task, this happens at post time. For a delayed task, this happens some
41 // time after the task's delay has expired. If the task hasn't been inserted 44 // time after the task's delay has expired. If the task hasn't been inserted
42 // in a sequence yet, this defaults to a null TimeTicks. 45 // in a sequence yet, this defaults to a null TimeTicks.
43 TimeTicks sequenced_time; 46 TimeTicks sequenced_time;
44 47
45 // A reference to the SequencedTaskRunner or SingleThreadTaskRunner that 48 // A reference to the SequencedTaskRunner or SingleThreadTaskRunner that
46 // posted this task, if any. Used to set ThreadTaskRunnerHandle and/or 49 // posted this task, if any. Used to set ThreadTaskRunnerHandle and/or
47 // SequencedTaskRunnerHandle while the task is running. 50 // SequencedTaskRunnerHandle while the task is running.
48 // Note: this creates an ownership cycle 51 // Note: this creates an ownership cycle
49 // Sequence -> Task -> TaskRunner -> Sequence -> ... 52 // Sequence -> Task -> TaskRunner -> Sequence -> ...
50 // but that's okay as it's broken when the Task is popped from its Sequence 53 // but that's okay as it's broken when the Task is popped from its Sequence
51 // after being executed which means this cycle forces the TaskRunner to stick 54 // after being executed which means this cycle forces the TaskRunner to stick
52 // around until all its tasks have been executed which is a requirement to 55 // around until all its tasks have been executed which is a requirement to
53 // support TaskRunnerHandles. 56 // support TaskRunnerHandles.
54 scoped_refptr<SequencedTaskRunner> sequenced_task_runner_ref; 57 scoped_refptr<SequencedTaskRunner> sequenced_task_runner_ref;
55 scoped_refptr<SingleThreadTaskRunner> single_thread_task_runner_ref; 58 scoped_refptr<SingleThreadTaskRunner> single_thread_task_runner_ref;
56 59
57 private: 60 private:
58 // Disallow copies to make sure no unnecessary ref-bumps are incurred. Making 61 // Disallow copies to make sure no unnecessary ref-bumps are incurred. Making
59 // it move-only would be an option, but isn't necessary for now. 62 // it move-only would be an option, but isn't necessary for now.
60 DISALLOW_COPY_AND_ASSIGN(Task); 63 DISALLOW_COPY_AND_ASSIGN(Task);
61 }; 64 };
62 65
63 } // namespace internal 66 } // namespace internal
64 } // namespace base 67 } // namespace base
65 68
66 #endif // BASE_TASK_SCHEDULER_TASK_H_ 69 #endif // BASE_TASK_SCHEDULER_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698