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

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

Issue 2383193002: TaskScheduler: Adjust shutdown behavior of delayed tasks. (Closed)
Patch Set: 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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/pending_task.h" 13 #include "base/pending_task.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/task_scheduler/task_traits.h" 16 #include "base/task_scheduler/task_traits.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 18
19 namespace base { 19 namespace base {
20 namespace internal { 20 namespace internal {
21 21
22 // A task is a unit of work inside the task scheduler. Support for tracing and 22 // A task is a unit of work inside the task scheduler. Support for tracing and
23 // profiling inherited from PendingTask. 23 // profiling inherited from PendingTask.
24 struct BASE_EXPORT Task : public PendingTask { 24 struct BASE_EXPORT Task : public PendingTask {
25 // |posted_from| is the site the task was posted from. |task| is the closure 25 // |posted_from| is the site the task was posted from. |task| is the closure
26 // to run. |traits| is metadata about the task. |delay| is a delay that must 26 // to run. |traits| is metadata about the task. |delay| is a delay that must
27 // expire before the Task runs. 27 // expire before the Task runs. If |delay| is non-zero and the shutdown
28 // behavior in |traits| is BLOCK_SHUTDOWN, the shutdown behavior is
29 // automatically changed to SKIP_ON_SHUTDOWN.
28 Task(const tracked_objects::Location& posted_from, 30 Task(const tracked_objects::Location& posted_from,
29 const Closure& task, 31 const Closure& task,
30 const TaskTraits& traits, 32 const TaskTraits& traits,
31 const TimeDelta& delay); 33 TimeDelta delay);
gab 2016/09/30 19:01:26 Is passing TimeDelta by value common practice? I k
fdoray 2016/09/30 19:10:11 See https://cs.chromium.org/chromium/src/base/time
robliao 2016/09/30 19:16:56 I don't think there is a style ruling on passing b
gab 2016/09/30 19:34:45 IMO by value only wins because of https://cs.chrom
32 ~Task(); 34 ~Task();
33 35
34 // The TaskTraits of this task. 36 // The TaskTraits of this task.
35 const TaskTraits traits; 37 const TaskTraits traits;
36 38
37 // The time at which the task was inserted in its sequence. For an undelayed 39 // The time at which the task was inserted in its sequence. For an undelayed
38 // task, this happens at post time. For a delayed task, this happens some 40 // task, this happens at post time. For a delayed task, this happens some
39 // time after the task's delay has expired. If the task hasn't been inserted 41 // time after the task's delay has expired. If the task hasn't been inserted
40 // in a sequence yet, this defaults to a null TimeTicks. 42 // in a sequence yet, this defaults to a null TimeTicks.
41 TimeTicks sequenced_time; 43 TimeTicks sequenced_time;
(...skipping 13 matching lines...) Expand all
55 private: 57 private:
56 // Disallow copies to make sure no unnecessary ref-bumps are incurred. Making 58 // Disallow copies to make sure no unnecessary ref-bumps are incurred. Making
57 // it move-only would be an option, but isn't necessary for now. 59 // it move-only would be an option, but isn't necessary for now.
58 DISALLOW_COPY_AND_ASSIGN(Task); 60 DISALLOW_COPY_AND_ASSIGN(Task);
59 }; 61 };
60 62
61 } // namespace internal 63 } // namespace internal
62 } // namespace base 64 } // namespace base
63 65
64 #endif // BASE_TASK_SCHEDULER_TASK_H_ 66 #endif // BASE_TASK_SCHEDULER_TASK_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/task.cc » ('j') | base/task_scheduler/task.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698