| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 TaskTraits& TaskTraits::MayBlock() { | 27 TaskTraits& TaskTraits::MayBlock() { |
| 28 may_block_ = true; | 28 may_block_ = true; |
| 29 return *this; | 29 return *this; |
| 30 } | 30 } |
| 31 | 31 |
| 32 TaskTraits& TaskTraits::WithSyncPrimitives() { | 32 TaskTraits& TaskTraits::WithSyncPrimitives() { |
| 33 with_sync_primitives_ = true; | 33 with_sync_primitives_ = true; |
| 34 return *this; | 34 return *this; |
| 35 } | 35 } |
| 36 | 36 |
| 37 TaskTraits& TaskTraits::WithFileIO() { | |
| 38 return MayBlock(); | |
| 39 } | |
| 40 | |
| 41 TaskTraits& TaskTraits::WithWait() { | |
| 42 return MayBlock().WithSyncPrimitives(); | |
| 43 } | |
| 44 | |
| 45 TaskTraits& TaskTraits::WithPriority(TaskPriority priority) { | 37 TaskTraits& TaskTraits::WithPriority(TaskPriority priority) { |
| 46 priority_ = priority; | 38 priority_ = priority; |
| 47 return *this; | 39 return *this; |
| 48 } | 40 } |
| 49 | 41 |
| 50 TaskTraits& TaskTraits::WithShutdownBehavior( | 42 TaskTraits& TaskTraits::WithShutdownBehavior( |
| 51 TaskShutdownBehavior shutdown_behavior) { | 43 TaskShutdownBehavior shutdown_behavior) { |
| 52 shutdown_behavior_ = shutdown_behavior; | 44 shutdown_behavior_ = shutdown_behavior; |
| 53 return *this; | 45 return *this; |
| 54 } | 46 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 85 return os; | 77 return os; |
| 86 } | 78 } |
| 87 | 79 |
| 88 std::ostream& operator<<(std::ostream& os, | 80 std::ostream& operator<<(std::ostream& os, |
| 89 const TaskShutdownBehavior& shutdown_behavior) { | 81 const TaskShutdownBehavior& shutdown_behavior) { |
| 90 os << TaskShutdownBehaviorToString(shutdown_behavior); | 82 os << TaskShutdownBehaviorToString(shutdown_behavior); |
| 91 return os; | 83 return os; |
| 92 } | 84 } |
| 93 | 85 |
| 94 } // namespace base | 86 } // namespace base |
| OLD | NEW |