| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/task_scheduler/task_traits.h" | 5 #include "base/task_scheduler/task_traits.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 priority_ = priority; | 27 priority_ = priority; |
| 28 return *this; | 28 return *this; |
| 29 } | 29 } |
| 30 | 30 |
| 31 TaskTraits& TaskTraits::WithShutdownBehavior( | 31 TaskTraits& TaskTraits::WithShutdownBehavior( |
| 32 TaskShutdownBehavior shutdown_behavior) { | 32 TaskShutdownBehavior shutdown_behavior) { |
| 33 shutdown_behavior_ = shutdown_behavior; | 33 shutdown_behavior_ = shutdown_behavior; |
| 34 return *this; | 34 return *this; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void PrintTo(const TaskPriority& task_priority, std::ostream* os) { | 37 std::ostream& operator<<(std::ostream& os, const TaskPriority& task_priority) { |
| 38 switch (task_priority) { | 38 switch (task_priority) { |
| 39 case TaskPriority::BACKGROUND: | 39 case TaskPriority::BACKGROUND: |
| 40 *os << "BACKGROUND"; | 40 os << "BACKGROUND"; |
| 41 break; | 41 break; |
| 42 case TaskPriority::USER_VISIBLE: | 42 case TaskPriority::USER_VISIBLE: |
| 43 *os << "USER_VISIBLE"; | 43 os << "USER_VISIBLE"; |
| 44 break; | 44 break; |
| 45 case TaskPriority::USER_BLOCKING: | 45 case TaskPriority::USER_BLOCKING: |
| 46 *os << "USER_BLOCKING"; | 46 os << "USER_BLOCKING"; |
| 47 break; | 47 break; |
| 48 } | 48 } |
| 49 return os; |
| 50 } |
| 51 |
| 52 std::ostream& operator<<(std::ostream& os, |
| 53 const TaskShutdownBehavior& shutdown_behavior) { |
| 54 switch (shutdown_behavior) { |
| 55 case TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN: |
| 56 os << "CONTINUE_ON_SHUTDOWN"; |
| 57 break; |
| 58 case TaskShutdownBehavior::SKIP_ON_SHUTDOWN: |
| 59 os << "SKIP_ON_SHUTDOWN"; |
| 60 break; |
| 61 case TaskShutdownBehavior::BLOCK_SHUTDOWN: |
| 62 os << "BLOCK_SHUTDOWN"; |
| 63 break; |
| 64 } |
| 65 return os; |
| 49 } | 66 } |
| 50 | 67 |
| 51 } // namespace base | 68 } // namespace base |
| OLD | NEW |