OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_LAZY_TASK_RUNNER_H_ | 5 #ifndef BASE_TASK_SCHEDULER_LAZY_TASK_RUNNER_H_ |
6 #define BASE_TASK_SCHEDULER_LAZY_TASK_RUNNER_H_ | 6 #define BASE_TASK_SCHEDULER_LAZY_TASK_RUNNER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 __LINE__) = traits | 98 __LINE__) = traits |
99 | 99 |
100 // |traits| are TaskTraits used when creating the SingleThreadTaskRunner. | 100 // |traits| are TaskTraits used when creating the SingleThreadTaskRunner. |
101 // |thread_mode| specifies whether the SingleThreadTaskRunner can share its | 101 // |thread_mode| specifies whether the SingleThreadTaskRunner can share its |
102 // thread with other SingleThreadTaskRunners. | 102 // thread with other SingleThreadTaskRunners. |
103 #define LAZY_SINGLE_THREAD_TASK_RUNNER_INITIALIZER(traits, thread_mode) \ | 103 #define LAZY_SINGLE_THREAD_TASK_RUNNER_INITIALIZER(traits, thread_mode) \ |
104 base::LazySingleThreadTaskRunner::CreateInternal(traits, thread_mode); \ | 104 base::LazySingleThreadTaskRunner::CreateInternal(traits, thread_mode); \ |
105 ALLOW_UNUSED_TYPE constexpr base::TaskTraits \ | 105 ALLOW_UNUSED_TYPE constexpr base::TaskTraits \ |
106 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyTraitsAreConstexpr, \ | 106 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyTraitsAreConstexpr, \ |
107 __LINE__) = traits; \ | 107 __LINE__) = traits; \ |
108 ALLOW_UNUSED_TYPE constexpr SingleThreadTaskRunnerThreadMode \ | 108 ALLOW_UNUSED_TYPE constexpr base::SingleThreadTaskRunnerThreadMode \ |
achuithb
2017/06/19 22:34:42
Should this be a separate CL?
xiyuan
2017/06/19 23:00:26
Done. Moved it to https://codereview.chromium.org/
| |
109 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyThreadModeIsConstexpr, \ | 109 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyThreadModeIsConstexpr, \ |
110 __LINE__) = thread_mode | 110 __LINE__) = thread_mode |
111 | 111 |
112 // |traits| are TaskTraits used when creating the COM STA | 112 // |traits| are TaskTraits used when creating the COM STA |
113 // SingleThreadTaskRunner. |thread_mode| specifies whether the COM STA | 113 // SingleThreadTaskRunner. |thread_mode| specifies whether the COM STA |
114 // SingleThreadTaskRunner can share its thread with other | 114 // SingleThreadTaskRunner can share its thread with other |
115 // SingleThreadTaskRunners. | 115 // SingleThreadTaskRunners. |
116 #define LAZY_COM_STA_TASK_RUNNER_INITIALIZER(traits, thread_mode) \ | 116 #define LAZY_COM_STA_TASK_RUNNER_INITIALIZER(traits, thread_mode) \ |
117 base::LazyCOMSTATaskRunner::CreateInternal(traits, thread_mode); \ | 117 base::LazyCOMSTATaskRunner::CreateInternal(traits, thread_mode); \ |
118 ALLOW_UNUSED_TYPE constexpr base::TaskTraits \ | 118 ALLOW_UNUSED_TYPE constexpr base::TaskTraits \ |
119 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyTraitsAreConstexpr, \ | 119 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyTraitsAreConstexpr, \ |
120 __LINE__) = traits; \ | 120 __LINE__) = traits; \ |
121 ALLOW_UNUSED_TYPE constexpr SingleThreadTaskRunnerThreadMode \ | 121 ALLOW_UNUSED_TYPE constexpr base::SingleThreadTaskRunnerThreadMode \ |
122 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyThreadModeIsConstexpr, \ | 122 LAZY_TASK_RUNNER_CONCATENATE_INTERNAL(kVerifyThreadModeIsConstexpr, \ |
123 __LINE__) = thread_mode | 123 __LINE__) = thread_mode |
124 | 124 |
125 namespace internal { | 125 namespace internal { |
126 | 126 |
127 template <typename TaskRunnerType, bool com_sta> | 127 template <typename TaskRunnerType, bool com_sta> |
128 class BASE_EXPORT LazyTaskRunner { | 128 class BASE_EXPORT LazyTaskRunner { |
129 public: | 129 public: |
130 // Use the macros above rather than a direct call to this. | 130 // Use the macros above rather than a direct call to this. |
131 // | 131 // |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 // List of callbacks to run on destruction. | 201 // List of callbacks to run on destruction. |
202 std::vector<OnceClosure> callbacks_; | 202 std::vector<OnceClosure> callbacks_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(ScopedLazyTaskRunnerListForTesting); | 204 DISALLOW_COPY_AND_ASSIGN(ScopedLazyTaskRunnerListForTesting); |
205 }; | 205 }; |
206 | 206 |
207 } // namespace internal | 207 } // namespace internal |
208 } // namespace base | 208 } // namespace base |
209 | 209 |
210 #endif // BASE_TASK_SCHEDULER_LAZY_TASK_RUNNER_H_ | 210 #endif // BASE_TASK_SCHEDULER_LAZY_TASK_RUNNER_H_ |
OLD | NEW |