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 23 matching lines...) Expand all Loading... |
34 // Example: Generating data shown in the UI immediately after a click. | 34 // Example: Generating data shown in the UI immediately after a click. |
35 USER_BLOCKING, | 35 USER_BLOCKING, |
36 // This will always be equal to the highest priority available. | 36 // This will always be equal to the highest priority available. |
37 HIGHEST = USER_BLOCKING, | 37 HIGHEST = USER_BLOCKING, |
38 }; | 38 }; |
39 | 39 |
40 // Valid shutdown behaviors supported by the task scheduler. | 40 // Valid shutdown behaviors supported by the task scheduler. |
41 enum class TaskShutdownBehavior { | 41 enum class TaskShutdownBehavior { |
42 // Tasks posted with this mode which have not started executing before | 42 // Tasks posted with this mode which have not started executing before |
43 // shutdown is initiated will never run. Tasks with this mode running at | 43 // shutdown is initiated will never run. Tasks with this mode running at |
44 // shutdown will be ignored (the worker thread will not be joined). | 44 // shutdown will be ignored (the worker will not be joined). |
45 // | 45 // |
46 // This option provides a nice way to post stuff you don't want blocking | 46 // This option provides a nice way to post stuff you don't want blocking |
47 // shutdown. For example, you might be doing a slow DNS lookup and if it's | 47 // shutdown. For example, you might be doing a slow DNS lookup and if it's |
48 // blocked on the OS, you may not want to stop shutdown, since the result | 48 // blocked on the OS, you may not want to stop shutdown, since the result |
49 // doesn't really matter at that point. | 49 // doesn't really matter at that point. |
50 // | 50 // |
51 // However, you need to be very careful what you do in your callback when you | 51 // However, you need to be very careful what you do in your callback when you |
52 // use this option. Since the thread will continue to run until the OS | 52 // use this option. Since the thread will continue to run until the OS |
53 // terminates the process, the app can be in the process of tearing down when | 53 // terminates the process, the app can be in the process of tearing down when |
54 // you're running. This means any singletons or global objects you use may | 54 // you're running. This means any singletons or global objects you use may |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 BASE_EXPORT std::ostream& operator<<(std::ostream& os, | 131 BASE_EXPORT std::ostream& operator<<(std::ostream& os, |
132 const TaskPriority& shutdown_behavior); | 132 const TaskPriority& shutdown_behavior); |
133 | 133 |
134 BASE_EXPORT std::ostream& operator<<( | 134 BASE_EXPORT std::ostream& operator<<( |
135 std::ostream& os, | 135 std::ostream& os, |
136 const TaskShutdownBehavior& shutdown_behavior); | 136 const TaskShutdownBehavior& shutdown_behavior); |
137 | 137 |
138 } // namespace base | 138 } // namespace base |
139 | 139 |
140 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ | 140 #endif // BASE_TASK_SCHEDULER_TASK_TRAITS_H_ |
OLD | NEW |