OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_TEST_SCHEDULER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ |
6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ | 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 }; | 155 }; |
156 | 156 |
157 class TestScheduler : public Scheduler { | 157 class TestScheduler : public Scheduler { |
158 public: | 158 public: |
159 static scoped_ptr<TestScheduler> Create( | 159 static scoped_ptr<TestScheduler> Create( |
160 scoped_refptr<TestNowSource> now_src, | 160 scoped_refptr<TestNowSource> now_src, |
161 SchedulerClient* client, | 161 SchedulerClient* client, |
162 const SchedulerSettings& scheduler_settings, | 162 const SchedulerSettings& scheduler_settings, |
163 int layer_tree_host_id, | 163 int layer_tree_host_id, |
164 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner, | 164 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner, |
165 base::PowerMonitor* power_monitor) { | 165 base::PowerMonitor* power_monitor, |
| 166 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
166 TestSchedulerFrameSourcesConstructor frame_sources_constructor( | 167 TestSchedulerFrameSourcesConstructor frame_sources_constructor( |
167 task_runner.get(), now_src.get()); | 168 task_runner.get(), now_src.get()); |
168 return make_scoped_ptr(new TestScheduler(now_src, | 169 return make_scoped_ptr(new TestScheduler( |
169 client, | 170 now_src, |
170 scheduler_settings, | 171 client, |
171 layer_tree_host_id, | 172 scheduler_settings, |
172 task_runner, | 173 layer_tree_host_id, |
173 power_monitor, | 174 task_runner, |
174 &frame_sources_constructor)); | 175 power_monitor, |
| 176 &frame_sources_constructor, |
| 177 external_begin_frame_source.Pass())); |
175 } | 178 } |
176 | 179 |
177 // Extra test helper functionality | 180 // Extra test helper functionality |
178 bool IsBeginRetroFrameArgsEmpty() const { | 181 bool IsBeginRetroFrameArgsEmpty() const { |
179 return begin_retro_frame_args_.empty(); | 182 return begin_retro_frame_args_.empty(); |
180 } | 183 } |
181 | 184 |
182 BeginFrameSource& frame_source() { return *frame_source_; } | 185 BeginFrameSource& frame_source() { return *frame_source_; } |
183 | 186 |
184 ~TestScheduler() override; | 187 ~TestScheduler() override; |
185 | 188 |
186 protected: | 189 protected: |
187 // Overridden from Scheduler. | 190 // Overridden from Scheduler. |
188 base::TimeTicks Now() const override; | 191 base::TimeTicks Now() const override; |
189 | 192 |
190 private: | 193 private: |
191 TestScheduler( | 194 TestScheduler( |
192 scoped_refptr<TestNowSource> now_src, | 195 scoped_refptr<TestNowSource> now_src, |
193 SchedulerClient* client, | 196 SchedulerClient* client, |
194 const SchedulerSettings& scheduler_settings, | 197 const SchedulerSettings& scheduler_settings, |
195 int layer_tree_host_id, | 198 int layer_tree_host_id, |
196 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, | 199 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, |
197 base::PowerMonitor* power_monitor, | 200 base::PowerMonitor* power_monitor, |
198 TestSchedulerFrameSourcesConstructor* frame_sources_constructor); | 201 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, |
| 202 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
199 | 203 |
200 scoped_refptr<TestNowSource> now_src_; | 204 scoped_refptr<TestNowSource> now_src_; |
201 }; | 205 }; |
202 | 206 |
203 } // namespace cc | 207 } // namespace cc |
204 | 208 |
205 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 209 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
OLD | NEW |