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 |
11 // Do not rely on defaults hard-coded below beyond the guarantees described in | 11 // Do not rely on defaults hard-coded below beyond the guarantees described in |
12 // the header; anything else is subject to change. Tasks should explicitly | 12 // the header; anything else is subject to change. Tasks should explicitly |
13 // request defaults if the behavior is critical to the task. | 13 // request defaults if the behavior is critical to the task. |
14 TaskTraits::TaskTraits() | 14 TaskTraits::TaskTraits() |
15 : with_file_io_(false), | 15 : with_file_io_(false), |
16 priority_(TaskPriority::BACKGROUND), | 16 priority_(TaskPriority::BACKGROUND), |
17 shutdown_behavior_(TaskShutdownBehavior::BLOCK_SHUTDOWN) {} | 17 shutdown_behavior_(TaskShutdownBehavior::BLOCK_SHUTDOWN) {} |
18 | 18 |
19 TaskTraits::~TaskTraits() = default; | |
20 | |
21 TaskTraits& TaskTraits::WithFileIO() { | 19 TaskTraits& TaskTraits::WithFileIO() { |
22 with_file_io_ = true; | 20 with_file_io_ = true; |
23 return *this; | 21 return *this; |
24 } | 22 } |
25 | 23 |
26 TaskTraits& TaskTraits::WithPriority(TaskPriority priority) { | 24 TaskTraits& TaskTraits::WithPriority(TaskPriority priority) { |
27 priority_ = priority; | 25 priority_ = priority; |
28 return *this; | 26 return *this; |
29 } | 27 } |
30 | 28 |
(...skipping 28 matching lines...) Expand all Loading... |
59 os << "SKIP_ON_SHUTDOWN"; | 57 os << "SKIP_ON_SHUTDOWN"; |
60 break; | 58 break; |
61 case TaskShutdownBehavior::BLOCK_SHUTDOWN: | 59 case TaskShutdownBehavior::BLOCK_SHUTDOWN: |
62 os << "BLOCK_SHUTDOWN"; | 60 os << "BLOCK_SHUTDOWN"; |
63 break; | 61 break; |
64 } | 62 } |
65 return os; | 63 return os; |
66 } | 64 } |
67 | 65 |
68 } // namespace base | 66 } // namespace base |
OLD | NEW |