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

Unified Diff: base/task_scheduler/task_traits.h

Issue 2831883003: Do not inherit TaskPriority in TaskTraits. (Closed)
Patch Set: CR-gab-34 Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/post_task.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 435fdac9af3843d18cec36bd441dacb6e74f91cf..04aea49f81202a8590f63715752da5a8b9950b4b 100644
--- a/base/task_scheduler/task_traits.h
+++ b/base/task_scheduler/task_traits.h
@@ -142,6 +142,9 @@ class BASE_EXPORT TaskTraits {
// Returns true if tasks with these traits may use base/ sync primitives.
bool with_base_sync_primitives() const { return with_base_sync_primitives_; }
+ // Returns true if the priority was set explicitly.
+ bool priority_set_explicitly() const { return priority_set_explicitly_; }
+
// Returns the priority of tasks with these traits.
TaskPriority priority() const { return priority_; }
@@ -149,10 +152,15 @@ class BASE_EXPORT TaskTraits {
TaskShutdownBehavior shutdown_behavior() const { return shutdown_behavior_; }
private:
- bool may_block_;
- bool with_base_sync_primitives_;
- TaskPriority priority_;
- TaskShutdownBehavior shutdown_behavior_;
+ // Do not rely on defaults hard-coded below beyond the guarantees described on
+ // the constructor; anything else is subject to change. Tasks should
+ // explicitly request defaults if the behavior is critical to the task.
+ bool may_block_ = false;
+ bool with_base_sync_primitives_ = false;
+ bool priority_set_explicitly_ = false;
+ TaskPriority priority_ = TaskPriority::USER_VISIBLE;
+ TaskShutdownBehavior shutdown_behavior_ =
+ TaskShutdownBehavior::SKIP_ON_SHUTDOWN;
};
// Returns string literals for the enums defined in this file. These methods
« no previous file with comments | « base/task_scheduler/post_task.cc ('k') | base/task_scheduler/task_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698