Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: cc/test/scheduler_test_common.cc

Issue 1132753008: Replaced TestNowSource with SimpleTestTickClock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 void FakeTimeSourceClient::OnTimerTick() { 13 void FakeTimeSourceClient::OnTimerTick() {
14 tick_called_ = true; 14 tick_called_ = true;
15 } 15 }
16 16
17 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 17 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
18 18
19 TestDelayBasedTimeSource::TestDelayBasedTimeSource( 19 TestDelayBasedTimeSource::TestDelayBasedTimeSource(
20 scoped_refptr<TestNowSource> now_src, 20 base::SimpleTestTickClock* now_src,
21 base::TimeDelta interval, 21 base::TimeDelta interval,
22 OrderedSimpleTaskRunner* task_runner) 22 OrderedSimpleTaskRunner* task_runner)
23 : DelayBasedTimeSource(interval, task_runner), now_src_(now_src) { 23 : DelayBasedTimeSource(interval, task_runner), now_src_(now_src) {
24 } 24 }
25 25
26 base::TimeTicks TestDelayBasedTimeSource::Now() const { 26 base::TimeTicks TestDelayBasedTimeSource::Now() const {
27 return now_src_->Now(); 27 return now_src_->NowTicks();
28 } 28 }
29 29
30 std::string TestDelayBasedTimeSource::TypeString() const { 30 std::string TestDelayBasedTimeSource::TypeString() const {
31 return "TestDelayBasedTimeSource"; 31 return "TestDelayBasedTimeSource";
32 } 32 }
33 33
34 TestDelayBasedTimeSource::~TestDelayBasedTimeSource() { 34 TestDelayBasedTimeSource::~TestDelayBasedTimeSource() {
35 } 35 }
36 36
37 void FakeBeginFrameSource::DidFinishFrame(size_t remaining_frames) { 37 void FakeBeginFrameSource::DidFinishFrame(size_t remaining_frames) {
38 remaining_frames_ = remaining_frames; 38 remaining_frames_ = remaining_frames;
39 } 39 }
40 void FakeBeginFrameSource::AsValueInto( 40 void FakeBeginFrameSource::AsValueInto(
41 base::trace_event::TracedValue* dict) const { 41 base::trace_event::TracedValue* dict) const {
42 dict->SetString("type", "FakeBeginFrameSource"); 42 dict->SetString("type", "FakeBeginFrameSource");
43 BeginFrameSourceBase::AsValueInto(dict); 43 BeginFrameSourceBase::AsValueInto(dict);
44 } 44 }
45 45
46 TestBackToBackBeginFrameSource::TestBackToBackBeginFrameSource( 46 TestBackToBackBeginFrameSource::TestBackToBackBeginFrameSource(
47 scoped_refptr<TestNowSource> now_src, 47 base::SimpleTestTickClock* now_src,
48 base::SingleThreadTaskRunner* task_runner) 48 base::SingleThreadTaskRunner* task_runner)
49 : BackToBackBeginFrameSource(task_runner), now_src_(now_src) { 49 : BackToBackBeginFrameSource(task_runner), now_src_(now_src) {
50 } 50 }
51 51
52 TestBackToBackBeginFrameSource::~TestBackToBackBeginFrameSource() { 52 TestBackToBackBeginFrameSource::~TestBackToBackBeginFrameSource() {
53 } 53 }
54 54
55 base::TimeTicks TestBackToBackBeginFrameSource::Now() { 55 base::TimeTicks TestBackToBackBeginFrameSource::Now() {
56 return now_src_->Now(); 56 return now_src_->NowTicks();
57 } 57 }
58 58
59 TestSyntheticBeginFrameSource::TestSyntheticBeginFrameSource( 59 TestSyntheticBeginFrameSource::TestSyntheticBeginFrameSource(
60 scoped_refptr<DelayBasedTimeSource> time_source) 60 scoped_refptr<DelayBasedTimeSource> time_source)
61 : SyntheticBeginFrameSource(time_source) { 61 : SyntheticBeginFrameSource(time_source) {
62 } 62 }
63 63
64 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() { 64 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() {
65 } 65 }
66 66
67 TestSchedulerFrameSourcesConstructor::TestSchedulerFrameSourcesConstructor( 67 TestSchedulerFrameSourcesConstructor::TestSchedulerFrameSourcesConstructor(
68 OrderedSimpleTaskRunner* test_task_runner, 68 OrderedSimpleTaskRunner* test_task_runner,
69 TestNowSource* now_src) 69 base::SimpleTestTickClock* now_src)
70 : test_task_runner_(test_task_runner), now_src_(now_src) { 70 : test_task_runner_(test_task_runner), now_src_(now_src) {
71 } 71 }
72 TestSchedulerFrameSourcesConstructor::~TestSchedulerFrameSourcesConstructor() { 72 TestSchedulerFrameSourcesConstructor::~TestSchedulerFrameSourcesConstructor() {
73 } 73 }
74 74
75 BeginFrameSource* 75 BeginFrameSource*
76 TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( 76 TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource(
77 Scheduler* scheduler) { 77 Scheduler* scheduler) {
78 if (scheduler->settings_.use_external_begin_frame_source) { 78 if (scheduler->settings_.use_external_begin_frame_source) {
79 return SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( 79 return SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource(
(...skipping 24 matching lines...) Expand all
104 "cc", 104 "cc",
105 "TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource", 105 "TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource",
106 "source", "TestBackToBackBeginFrameSource"); 106 "source", "TestBackToBackBeginFrameSource");
107 DCHECK(!scheduler->unthrottled_frame_source_internal_); 107 DCHECK(!scheduler->unthrottled_frame_source_internal_);
108 scheduler->unthrottled_frame_source_internal_ = 108 scheduler->unthrottled_frame_source_internal_ =
109 TestBackToBackBeginFrameSource::Create(now_src_, test_task_runner_); 109 TestBackToBackBeginFrameSource::Create(now_src_, test_task_runner_);
110 return scheduler->unthrottled_frame_source_internal_.get(); 110 return scheduler->unthrottled_frame_source_internal_.get();
111 } 111 }
112 112
113 TestScheduler::TestScheduler( 113 TestScheduler::TestScheduler(
114 scoped_refptr<TestNowSource> now_src, 114 base::SimpleTestTickClock* now_src,
115 SchedulerClient* client, 115 SchedulerClient* client,
116 const SchedulerSettings& scheduler_settings, 116 const SchedulerSettings& scheduler_settings,
117 int layer_tree_host_id, 117 int layer_tree_host_id,
118 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, 118 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner,
119 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, 119 TestSchedulerFrameSourcesConstructor* frame_sources_constructor,
120 scoped_ptr<BeginFrameSource> external_begin_frame_source) 120 scoped_ptr<BeginFrameSource> external_begin_frame_source)
121 : Scheduler(client, 121 : Scheduler(client,
122 scheduler_settings, 122 scheduler_settings,
123 layer_tree_host_id, 123 layer_tree_host_id,
124 test_task_runner, 124 test_task_runner,
125 external_begin_frame_source.Pass(), 125 external_begin_frame_source.Pass(),
126 frame_sources_constructor), 126 frame_sources_constructor),
127 now_src_(now_src) { 127 now_src_(now_src) {
128 } 128 }
129 129
130 base::TimeTicks TestScheduler::Now() const { 130 base::TimeTicks TestScheduler::Now() const {
131 return now_src_->Now(); 131 return now_src_->NowTicks();
132 } 132 }
133 133
134 TestScheduler::~TestScheduler() { 134 TestScheduler::~TestScheduler() {
135 } 135 }
136 136
137 } // namespace cc 137 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698