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

Unified Diff: base/task_scheduler/task_traits.h

Issue 2531663003: TaskScheduler: Add TaskTraits::WithWait(). (Closed)
Patch Set: CR gab #3 (enforce AssertWaitAllowed requires WithWait) 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
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..f1f7c6162c81c8be294f5727dccf62b70949cd52 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 other things than file I/O. In
robliao 2016/11/28 20:09:50 Nit: wait on other things that file I/O -> wait on
fdoray 2016/11/28 21:47:51 Done.
+ // 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 other things than file I/O is allowed by these
robliao 2016/11/28 20:09:50 Same as above.
fdoray 2016/11/28 21:47:51 Done.
+ // 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_;
};

Powered by Google App Engine
This is Rietveld 408576698