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