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 void TestDelayBasedTimeSource::SetNow(base::TimeTicks time) { |
| 20 test_task_runner_->SetNow(time); |
| 21 } |
| 22 |
| 23 std::string TestDelayBasedTimeSource::TypeString() const { |
| 24 return "TestDelayBasedTimeSource"; |
| 25 } |
| 26 |
| 27 base::TimeTicks TestDelayBasedTimeSource::Now() const { |
| 28 return test_task_runner_->Now(); |
| 29 } |
| 30 |
| 31 base::TimeTicks TestScheduler::Now() const { |
| 32 return test_task_runner_->Now(); |
| 33 } |
| 34 |
| 35 TestScheduler::TestScheduler( |
| 36 SchedulerClient* client, |
| 37 const SchedulerSettings& scheduler_settings, |
| 38 int layer_tree_host_id, |
| 39 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner) |
| 40 : Scheduler(client, |
| 41 scheduler_settings, |
| 42 layer_tree_host_id, |
| 43 test_task_runner), |
| 44 test_task_runner_(test_task_runner.get()) { |
| 45 if (!settings_.begin_frame_scheduling_enabled) { |
| 46 scoped_refptr<DelayBasedTimeSource> time_source = |
| 47 TestDelayBasedTimeSource::Create(VSyncInterval(), test_task_runner_); |
| 48 synthetic_begin_frame_source_.reset( |
| 49 new SyntheticBeginFrameSource(this, time_source)); |
| 50 } |
| 51 } |
| 52 |
| 53 void TestScheduler::SetNow(base::TimeTicks time) { |
| 54 test_task_runner_->SetNow(time); |
| 55 } |
| 56 |
17 } // namespace cc | 57 } // namespace cc |
OLD | NEW |