| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/test/scheduler_test_common.h" | 5 #include "cc/test/scheduler_test_common.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 | 175 |
| 176 base::TimeDelta FakeCompositorTimingHistory::ActivateDurationEstimate() const { | 176 base::TimeDelta FakeCompositorTimingHistory::ActivateDurationEstimate() const { |
| 177 return activate_duration_; | 177 return activate_duration_; |
| 178 } | 178 } |
| 179 | 179 |
| 180 base::TimeDelta FakeCompositorTimingHistory::DrawDurationEstimate() const { | 180 base::TimeDelta FakeCompositorTimingHistory::DrawDurationEstimate() const { |
| 181 return draw_duration_; | 181 return draw_duration_; |
| 182 } | 182 } |
| 183 | 183 |
| 184 scoped_ptr<TestScheduler> TestScheduler::Create( | |
| 185 base::SimpleTestTickClock* now_src, | |
| 186 SchedulerClient* client, | |
| 187 const SchedulerSettings& settings, | |
| 188 int layer_tree_host_id, | |
| 189 OrderedSimpleTaskRunner* task_runner, | |
| 190 BeginFrameSource* external_frame_source, | |
| 191 scoped_ptr<CompositorTimingHistory> compositor_timing_history) { | |
| 192 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source; | |
| 193 if (!settings.use_external_begin_frame_source) { | |
| 194 synthetic_frame_source = TestSyntheticBeginFrameSource::Create( | |
| 195 now_src, task_runner, BeginFrameArgs::DefaultInterval()); | |
| 196 } | |
| 197 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source = | |
| 198 TestBackToBackBeginFrameSource::Create(now_src, task_runner); | |
| 199 return make_scoped_ptr(new TestScheduler( | |
| 200 now_src, client, settings, layer_tree_host_id, task_runner, | |
| 201 external_frame_source, std::move(synthetic_frame_source), | |
| 202 std::move(unthrottled_frame_source), | |
| 203 std::move(compositor_timing_history))); | |
| 204 } | |
| 205 | |
| 206 TestScheduler::TestScheduler( | 184 TestScheduler::TestScheduler( |
| 207 base::SimpleTestTickClock* now_src, | 185 base::SimpleTestTickClock* now_src, |
| 208 SchedulerClient* client, | 186 SchedulerClient* client, |
| 209 const SchedulerSettings& scheduler_settings, | 187 const SchedulerSettings& scheduler_settings, |
| 210 int layer_tree_host_id, | 188 int layer_tree_host_id, |
| 211 OrderedSimpleTaskRunner* task_runner, | 189 OrderedSimpleTaskRunner* task_runner, |
| 212 BeginFrameSource* external_frame_source, | 190 BeginFrameSource* begin_frame_source, |
| 213 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source, | |
| 214 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, | |
| 215 scoped_ptr<CompositorTimingHistory> compositor_timing_history) | 191 scoped_ptr<CompositorTimingHistory> compositor_timing_history) |
| 216 : Scheduler(client, | 192 : Scheduler(client, |
| 217 scheduler_settings, | 193 scheduler_settings, |
| 218 layer_tree_host_id, | 194 layer_tree_host_id, |
| 219 task_runner, | 195 task_runner, |
| 220 external_frame_source, | 196 begin_frame_source, |
| 221 std::move(synthetic_frame_source), | |
| 222 std::move(unthrottled_frame_source), | |
| 223 std::move(compositor_timing_history)), | 197 std::move(compositor_timing_history)), |
| 224 now_src_(now_src) {} | 198 now_src_(now_src) {} |
| 225 | 199 |
| 226 base::TimeTicks TestScheduler::Now() const { | 200 base::TimeTicks TestScheduler::Now() const { |
| 227 return now_src_->NowTicks(); | 201 return now_src_->NowTicks(); |
| 228 } | 202 } |
| 229 | 203 |
| 230 TestScheduler::~TestScheduler() { | 204 TestScheduler::~TestScheduler() { |
| 231 } | 205 } |
| 232 | 206 |
| 233 } // namespace cc | 207 } // namespace cc |
| OLD | NEW |