| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 | 14 |
| 15 // Do not rely on defaults hard-coded below beyond the guarantees described in | |
| 16 // the header; anything else is subject to change. Tasks should explicitly | |
| 17 // request defaults if the behavior is critical to the task. | |
| 18 TaskTraits::TaskTraits() | |
| 19 : may_block_(false), | |
| 20 with_base_sync_primitives_(false), | |
| 21 priority_(TaskPriority::INHERITED), | |
| 22 shutdown_behavior_(TaskShutdownBehavior::SKIP_ON_SHUTDOWN) {} | |
| 23 | |
| 24 TaskTraits::~TaskTraits() = default; | |
| 25 | |
| 26 TaskTraits& TaskTraits::MayBlock() { | 15 TaskTraits& TaskTraits::MayBlock() { |
| 27 may_block_ = true; | 16 may_block_ = true; |
| 28 return *this; | 17 return *this; |
| 29 } | 18 } |
| 30 | 19 |
| 31 TaskTraits& TaskTraits::WithBaseSyncPrimitives() { | 20 TaskTraits& TaskTraits::WithBaseSyncPrimitives() { |
| 32 with_base_sync_primitives_ = true; | 21 with_base_sync_primitives_ = true; |
| 33 return *this; | 22 return *this; |
| 34 } | 23 } |
| 35 | 24 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return os; | 67 return os; |
| 79 } | 68 } |
| 80 | 69 |
| 81 std::ostream& operator<<(std::ostream& os, | 70 std::ostream& operator<<(std::ostream& os, |
| 82 const TaskShutdownBehavior& shutdown_behavior) { | 71 const TaskShutdownBehavior& shutdown_behavior) { |
| 83 os << TaskShutdownBehaviorToString(shutdown_behavior); | 72 os << TaskShutdownBehaviorToString(shutdown_behavior); |
| 84 return os; | 73 return os; |
| 85 } | 74 } |
| 86 | 75 |
| 87 } // namespace base | 76 } // namespace base |
| OLD | NEW |