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 <string> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 | 10 |
9 namespace cc { | 11 namespace cc { |
10 | 12 |
11 void FakeTimeSourceClient::OnTimerTick() { | 13 void FakeTimeSourceClient::OnTimerTick() { |
12 tick_called_ = true; | 14 tick_called_ = true; |
13 } | 15 } |
14 | 16 |
15 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } | 17 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } |
16 | 18 |
| 19 TestDelayBasedTimeSource::TestDelayBasedTimeSource( |
| 20 scoped_refptr<TestNowSource> now_src, |
| 21 base::TimeDelta interval, |
| 22 OrderedSimpleTaskRunner* task_runner) |
| 23 : DelayBasedTimeSource(interval, task_runner), now_src_(now_src) { |
| 24 } |
| 25 |
| 26 base::TimeTicks TestDelayBasedTimeSource::Now() const { |
| 27 return now_src_->Now(); |
| 28 } |
| 29 |
| 30 std::string TestDelayBasedTimeSource::TypeString() const { |
| 31 return "TestDelayBasedTimeSource"; |
| 32 } |
| 33 |
| 34 TestDelayBasedTimeSource::~TestDelayBasedTimeSource() { |
| 35 } |
| 36 |
| 37 TestScheduler::TestScheduler( |
| 38 scoped_refptr<TestNowSource> now_src, |
| 39 SchedulerClient* client, |
| 40 const SchedulerSettings& scheduler_settings, |
| 41 int layer_tree_host_id, |
| 42 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner) |
| 43 : Scheduler(client, |
| 44 scheduler_settings, |
| 45 layer_tree_host_id, |
| 46 test_task_runner), |
| 47 now_src_(now_src), |
| 48 test_task_runner_(test_task_runner.get()) { |
| 49 if (!settings_.begin_frame_scheduling_enabled) { |
| 50 scoped_refptr<DelayBasedTimeSource> time_source = |
| 51 TestDelayBasedTimeSource::Create( |
| 52 now_src, VSyncInterval(), test_task_runner_); |
| 53 synthetic_begin_frame_source_.reset( |
| 54 new SyntheticBeginFrameSource(this, time_source)); |
| 55 } |
| 56 } |
| 57 |
| 58 base::TimeTicks TestScheduler::Now() const { |
| 59 return now_src_->Now(); |
| 60 } |
| 61 |
| 62 TestScheduler::~TestScheduler() { |
| 63 } |
| 64 |
17 } // namespace cc | 65 } // namespace cc |
OLD | NEW |