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

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

Issue 2541353003: TaskScheduler: Initialize TaskTraits with the priority of the current thread. (Closed)
Patch Set: improve comment Created 4 years 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
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/task_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TRAITS_H_ 5 #ifndef BASE_TASK_SCHEDULER_TASK_TRAITS_H_
6 #define BASE_TASK_SCHEDULER_TASK_TRAITS_H_ 6 #define BASE_TASK_SCHEDULER_TASK_TRAITS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Note: Tasks with BACKGROUND priority that block shutdown will be promoted 73 // Note: Tasks with BACKGROUND priority that block shutdown will be promoted
74 // to USER_VISIBLE priority during shutdown. 74 // to USER_VISIBLE priority during shutdown.
75 BLOCK_SHUTDOWN, 75 BLOCK_SHUTDOWN,
76 }; 76 };
77 77
78 // Describes metadata for a single task or a group of tasks. 78 // Describes metadata for a single task or a group of tasks.
79 class BASE_EXPORT TaskTraits { 79 class BASE_EXPORT TaskTraits {
80 public: 80 public:
81 // Constructs a default TaskTraits for tasks with 81 // Constructs a default TaskTraits for tasks with
82 // (1) no I/O, 82 // (1) no I/O,
83 // (2) low priority, and 83 // (2) priority inherited from the calling context, and
84 // (3) may block shutdown or be skipped on shutdown. 84 // (3) may block shutdown or be skipped on shutdown.
85 // Tasks that require stricter guarantees should highlight those by requesting 85 // Tasks that require stricter guarantees and/or know the specific
86 // TaskPriority appropriate for them should highlight those by requesting
86 // explicit traits below. 87 // explicit traits below.
87 TaskTraits(); 88 TaskTraits();
88 TaskTraits(const TaskTraits& other) = default; 89 TaskTraits(const TaskTraits& other) = default;
89 TaskTraits& operator=(const TaskTraits& other) = default; 90 TaskTraits& operator=(const TaskTraits& other) = default;
90 ~TaskTraits(); 91 ~TaskTraits();
91 92
92 // Allows tasks with these traits to wait on synchronous file I/O. 93 // Allows tasks with these traits to wait on synchronous file I/O.
93 TaskTraits& WithFileIO(); 94 TaskTraits& WithFileIO();
94 95
95 // Allows tasks with these traits to wait on things other than file I/O. In 96 // Allows tasks with these traits to wait on things other than file I/O. In
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // DCHECK and EXPECT statements. 135 // DCHECK and EXPECT statements.
135 BASE_EXPORT std::ostream& operator<<(std::ostream& os, 136 BASE_EXPORT std::ostream& operator<<(std::ostream& os,
136 const TaskPriority& shutdown_behavior); 137 const TaskPriority& shutdown_behavior);
137 BASE_EXPORT std::ostream& operator<<( 138 BASE_EXPORT std::ostream& operator<<(
138 std::ostream& os, 139 std::ostream& os,
139 const TaskShutdownBehavior& shutdown_behavior); 140 const TaskShutdownBehavior& shutdown_behavior);
140 141
141 } // namespace base 142 } // namespace base
142 143
143 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ 144 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/task_scheduler/task_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698