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 8b564f44f5a5cdb8477ac9e2f4966d807e1e2204..de0c3181e3756b1eb2cd57105474b033bc570e14 100644 |
| --- a/base/task_scheduler/task_traits.h |
| +++ b/base/task_scheduler/task_traits.h |
| @@ -5,32 +5,37 @@ |
| #ifndef BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
| #define BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
| +#include <stdint.h> |
| + |
| +#include <iosfwd> |
| + |
| #include "base/base_export.h" |
| #include "build/build_config.h" |
| namespace base { |
| -using TaskPriorityUnderlyingType = char; |
| +namespace internal { |
| +using TaskPriorityUnderlyingType = uint8_t; |
| +} // namespace internal |
| // Valid priorities supported by the task scheduler. |
|
gab
2016/02/18 20:22:34
Append something like this to the comment : "Note:
fdoray
2016/02/18 20:52:04
Done.
|
| -enum class TaskPriority : TaskPriorityUnderlyingType { |
| - // This task affects UI immediately after a user interaction. |
| - // Example: Generating data shown in the UI immediately after a click. |
| - USER_BLOCKING = 2, |
| +enum class TaskPriority : internal::TaskPriorityUnderlyingType { |
| + // User won't notice if this task takes an arbitrarily long time to complete. |
| + BACKGROUND = 0, |
| // This task affects UI or responsiveness of future user interactions. It is |
| // not an immediate response to a user interaction. |
| // Examples: |
| // - Updating the UI to reflect progress on a long task. |
| // - Loading data that might be shown in the UI after a future user |
| // interaction. |
| - USER_VISIBLE = 1, |
| - // Everything else (user won't notice if this takes an arbitrarily long time |
| - // to complete). |
| - BACKGROUND = 0, |
| + USER_VISIBLE, |
| + // This task affects UI immediately after a user interaction. |
| + // Example: Generating data shown in the UI immediately after a click. |
| + USER_BLOCKING, |
| + // This will always be equal to the highest priority available. |
| + HIGHEST = USER_BLOCKING, |
| }; |
| -const TaskPriorityUnderlyingType kNumTaskPriorities = 3; |
| - |
| // Valid shutdown behaviors supported by the task scheduler. |
| enum class TaskShutdownBehavior { |
| // Tasks posted with this mode which have not started executing before |
| @@ -117,6 +122,9 @@ enum class ExecutionMode { |
| SINGLE_THREADED, |
| }; |
| +// Pretty Printer for Google Test. |
| +void BASE_EXPORT PrintTo(const TaskPriority& task_priority, std::ostream* os); |
| + |
| } // namespace base |
| #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |