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

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

Issue 1201573002: cc: Remove BeginFrameSourcesConstructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return make_scoped_ptr( 126 return make_scoped_ptr(
127 new TestSyntheticBeginFrameSource(TestDelayBasedTimeSource::Create( 127 new TestSyntheticBeginFrameSource(TestDelayBasedTimeSource::Create(
128 now_src, initial_interval, task_runner))); 128 now_src, initial_interval, task_runner)));
129 } 129 }
130 130
131 protected: 131 protected:
132 TestSyntheticBeginFrameSource( 132 TestSyntheticBeginFrameSource(
133 scoped_refptr<DelayBasedTimeSource> time_source); 133 scoped_refptr<DelayBasedTimeSource> time_source);
134 }; 134 };
135 135
136 class TestScheduler;
137 class TestSchedulerFrameSourcesConstructor
138 : public SchedulerFrameSourcesConstructor {
139 public:
140 ~TestSchedulerFrameSourcesConstructor() override;
141
142 protected:
143 BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler) override;
144 BeginFrameSource* ConstructUnthrottledFrameSource(
145 Scheduler* scheduler) override;
146
147 OrderedSimpleTaskRunner* test_task_runner_;
148 // Not owned.
149 base::SimpleTestTickClock* now_src_;
150
151 protected:
152 explicit TestSchedulerFrameSourcesConstructor(
153 OrderedSimpleTaskRunner* test_task_runner,
154 base::SimpleTestTickClock* now_src);
155 friend class TestScheduler;
156 };
157
158 class TestScheduler : public Scheduler { 136 class TestScheduler : public Scheduler {
159 public: 137 public:
160 static scoped_ptr<TestScheduler> Create( 138 static scoped_ptr<TestScheduler> Create(
161 base::SimpleTestTickClock* now_src, 139 base::SimpleTestTickClock* now_src,
162 SchedulerClient* client, 140 SchedulerClient* client,
163 const SchedulerSettings& scheduler_settings, 141 const SchedulerSettings& scheduler_settings,
164 int layer_tree_host_id, 142 int layer_tree_host_id,
165 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner, 143 OrderedSimpleTaskRunner* task_runner,
166 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 144 BeginFrameSource* external_frame_source);
167 TestSchedulerFrameSourcesConstructor frame_sources_constructor(
168 task_runner.get(), now_src);
169 return make_scoped_ptr(new TestScheduler(
170 now_src,
171 client,
172 scheduler_settings,
173 layer_tree_host_id,
174 task_runner,
175 &frame_sources_constructor,
176 external_begin_frame_source.Pass()));
177 }
178 145
179 // Extra test helper functionality 146 // Extra test helper functionality
180 bool IsBeginRetroFrameArgsEmpty() const { 147 bool IsBeginRetroFrameArgsEmpty() const {
181 return begin_retro_frame_args_.empty(); 148 return begin_retro_frame_args_.empty();
182 } 149 }
183 150
184 bool CanStart() const { return state_machine_.CanStartForTesting(); } 151 bool CanStart() const { return state_machine_.CanStartForTesting(); }
185 152
186 BeginFrameSource& frame_source() { return *frame_source_; } 153 BeginFrameSource& frame_source() { return *frame_source_; }
187 bool FrameProductionThrottled() { return throttle_frame_production_; } 154 bool FrameProductionThrottled() { return throttle_frame_production_; }
188 155
189 ~TestScheduler() override; 156 ~TestScheduler() override;
190 157
191 void NotifyReadyToCommitThenActivateIfNeeded() { 158 void NotifyReadyToCommitThenActivateIfNeeded() {
192 NotifyReadyToCommit(); 159 NotifyReadyToCommit();
193 if (settings_.impl_side_painting) { 160 if (settings_.impl_side_painting) {
194 NotifyReadyToActivate(); 161 NotifyReadyToActivate();
195 } 162 }
196 } 163 }
197 164
198 base::TimeDelta BeginImplFrameInterval() { 165 base::TimeDelta BeginImplFrameInterval() {
199 return begin_impl_frame_tracker_.Interval(); 166 return begin_impl_frame_tracker_.Interval();
200 } 167 }
201 168
202 protected: 169 protected:
203 // Overridden from Scheduler. 170 // Overridden from Scheduler.
204 base::TimeTicks Now() const override; 171 base::TimeTicks Now() const override;
205 172
206 private: 173 private:
207 TestScheduler(base::SimpleTestTickClock* now_src, 174 TestScheduler(
208 SchedulerClient* client, 175 base::SimpleTestTickClock* now_src,
209 const SchedulerSettings& scheduler_settings, 176 SchedulerClient* client,
210 int layer_tree_host_id, 177 const SchedulerSettings& scheduler_settings,
211 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, 178 int layer_tree_host_id,
212 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, 179 OrderedSimpleTaskRunner* task_runner,
213 scoped_ptr<BeginFrameSource> external_begin_frame_source); 180 BeginFrameSource* external_frame_source,
181 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
182 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source);
214 183
215 // Not owned. 184 // Not owned.
216 base::SimpleTestTickClock* now_src_; 185 base::SimpleTestTickClock* now_src_;
217 }; 186 };
218 187
219 } // namespace cc 188 } // namespace cc
220 189
221 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ 190 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698