| 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 #ifndef BASE_TASK_SCHEDULER_TASK_TRAITS_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
| 6 #define BASE_TASK_SCHEDULER_TASK_TRAITS_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Avoid creating threads. Instead, use | 115 // Avoid creating threads. Instead, use |
| 116 // base::Create(Sequenced|SingleTreaded)TaskRunnerWithTraits(). If a thread is | 116 // base::Create(Sequenced|SingleTreaded)TaskRunnerWithTraits(). If a thread is |
| 117 // really needed, make it non-joinable and add cleanup work at the end of the | 117 // really needed, make it non-joinable and add cleanup work at the end of the |
| 118 // thread's main function (if using base::Thread, override Cleanup()). | 118 // thread's main function (if using base::Thread, override Cleanup()). |
| 119 // | 119 // |
| 120 // MayBlock() must be specified in conjunction with this trait if and only if | 120 // MayBlock() must be specified in conjunction with this trait if and only if |
| 121 // removing usage of sync primitives in the labeled tasks would still result | 121 // removing usage of sync primitives in the labeled tasks would still result |
| 122 // in tasks that may block (per MayBlock()'s definition). | 122 // in tasks that may block (per MayBlock()'s definition). |
| 123 TaskTraits& WithSyncPrimitives(); | 123 TaskTraits& WithSyncPrimitives(); |
| 124 | 124 |
| 125 // DEPRECATED | |
| 126 // TODO(fdoray): Remove this as part of crbug.com/675660 | |
| 127 TaskTraits& WithFileIO(); | |
| 128 | |
| 129 // DEPRECATED | |
| 130 // TODO(fdoray): Remove this as part of crbug.com/675660 | |
| 131 TaskTraits& WithWait(); | |
| 132 | |
| 133 // Applies |priority| to tasks with these traits. | 125 // Applies |priority| to tasks with these traits. |
| 134 TaskTraits& WithPriority(TaskPriority priority); | 126 TaskTraits& WithPriority(TaskPriority priority); |
| 135 | 127 |
| 136 // Applies |shutdown_behavior| to tasks with these traits. | 128 // Applies |shutdown_behavior| to tasks with these traits. |
| 137 TaskTraits& WithShutdownBehavior(TaskShutdownBehavior shutdown_behavior); | 129 TaskTraits& WithShutdownBehavior(TaskShutdownBehavior shutdown_behavior); |
| 138 | 130 |
| 139 // Returns true if tasks with these traits may block. | 131 // Returns true if tasks with these traits may block. |
| 140 bool may_block() const { return may_block_; } | 132 bool may_block() const { return may_block_; } |
| 141 | 133 |
| 142 // Returns true if tasks with these traits may wait on sync primitives. | 134 // Returns true if tasks with these traits may wait on sync primitives. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 169 // DCHECK and EXPECT statements. | 161 // DCHECK and EXPECT statements. |
| 170 BASE_EXPORT std::ostream& operator<<(std::ostream& os, | 162 BASE_EXPORT std::ostream& operator<<(std::ostream& os, |
| 171 const TaskPriority& shutdown_behavior); | 163 const TaskPriority& shutdown_behavior); |
| 172 BASE_EXPORT std::ostream& operator<<( | 164 BASE_EXPORT std::ostream& operator<<( |
| 173 std::ostream& os, | 165 std::ostream& os, |
| 174 const TaskShutdownBehavior& shutdown_behavior); | 166 const TaskShutdownBehavior& shutdown_behavior); |
| 175 | 167 |
| 176 } // namespace base | 168 } // namespace base |
| 177 | 169 |
| 178 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ | 170 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
| OLD | NEW |