Chromium Code Reviews| 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..95fdc6e230941cdf515a8fceae7d7bb30223d886 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::BACKGROUND; |
|
gab
2017/04/25 18:50:42
GetTaskPriorityForCurrentThread() defaults to USER
robliao
2017/04/25 20:06:47
+1
fdoray
2017/04/25 21:20:24
Done.
|
| + TaskShutdownBehavior shutdown_behavior_ = |
| + TaskShutdownBehavior::SKIP_ON_SHUTDOWN; |
| }; |
| // Returns string literals for the enums defined in this file. These methods |