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

Unified Diff: base/task_scheduler/task_traits.h

Issue 2531663003: TaskScheduler: Add TaskTraits::WithWait(). (Closed)
Patch Set: CR danakj #22 (AssertWaitAllowed) Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/task_scheduler/task_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_traits.h
diff --git a/base/task_scheduler/task_traits.h b/base/task_scheduler/task_traits.h
index 93b6d71e9c7c3842ca9e65fcde9c66558d0face8..12ff6d3553daea9e5bbb951bf99730b300a1e952 100644
--- a/base/task_scheduler/task_traits.h
+++ b/base/task_scheduler/task_traits.h
@@ -89,18 +89,28 @@ class BASE_EXPORT TaskTraits {
TaskTraits& operator=(const TaskTraits& other) = default;
~TaskTraits();
- // Allows tasks with these traits to do file I/O.
+ // Allows tasks with these traits to wait on synchronous file I/O.
TaskTraits& WithFileIO();
+ // Allows tasks with these traits to wait on things other than file I/O. In
+ // particular, they may wait on a WaitableEvent or a ConditionVariable, join a
+ // thread or a process, or make a blocking system call that doesn't involve
+ // interactions with the file system.
+ TaskTraits& WithWait();
+
// Applies |priority| to tasks with these traits.
TaskTraits& WithPriority(TaskPriority priority);
// Applies |shutdown_behavior| to tasks with these traits.
TaskTraits& WithShutdownBehavior(TaskShutdownBehavior shutdown_behavior);
- // Returns true if file I/O is allowed by these traits.
+ // Returns true if waiting on synchronous file I/O is allowed by these traits.
bool with_file_io() const { return with_file_io_; }
+ // Returns true if waiting on things other than file I/O is allowed by these
+ // traits.
+ bool with_wait() const { return with_wait_; }
+
// Returns the priority of tasks with these traits.
TaskPriority priority() const { return priority_; }
@@ -109,6 +119,7 @@ class BASE_EXPORT TaskTraits {
private:
bool with_file_io_;
+ bool with_wait_;
TaskPriority priority_;
TaskShutdownBehavior shutdown_behavior_;
};
« no previous file with comments | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/task_scheduler/task_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698