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

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: Remove refptr changes 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/surfaces/onscreen_display_client.cc ('k') | cc/test/scheduler_test_common.cc » ('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 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 protected: 154 protected:
155 explicit TestSyntheticBeginFrameSource( 155 explicit TestSyntheticBeginFrameSource(
156 scoped_ptr<DelayBasedTimeSource> time_source); 156 scoped_ptr<DelayBasedTimeSource> time_source);
157 157
158 private: 158 private:
159 DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource); 159 DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource);
160 }; 160 };
161 161
162 class TestScheduler;
163 class TestSchedulerFrameSourcesConstructor
164 : public SchedulerFrameSourcesConstructor {
165 public:
166 ~TestSchedulerFrameSourcesConstructor() override;
167
168 protected:
169 BeginFrameSource* ConstructPrimaryFrameSource(Scheduler* scheduler) override;
170 BeginFrameSource* ConstructUnthrottledFrameSource(
171 Scheduler* scheduler) override;
172
173 OrderedSimpleTaskRunner* test_task_runner_;
174 // Not owned.
175 base::SimpleTestTickClock* now_src_;
176
177 protected:
178 explicit TestSchedulerFrameSourcesConstructor(
179 OrderedSimpleTaskRunner* test_task_runner,
180 base::SimpleTestTickClock* now_src);
181 friend class TestScheduler;
182
183 private:
184 DISALLOW_COPY_AND_ASSIGN(TestSchedulerFrameSourcesConstructor);
185 };
186
187 class TestScheduler : public Scheduler { 162 class TestScheduler : public Scheduler {
188 public: 163 public:
189 static scoped_ptr<TestScheduler> Create( 164 static scoped_ptr<TestScheduler> Create(
190 base::SimpleTestTickClock* now_src, 165 base::SimpleTestTickClock* now_src,
191 SchedulerClient* client, 166 SchedulerClient* client,
192 const SchedulerSettings& scheduler_settings, 167 const SchedulerSettings& scheduler_settings,
193 int layer_tree_host_id, 168 int layer_tree_host_id,
194 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner, 169 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner,
195 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 170 BeginFrameSource* external_frame_source);
196 TestSchedulerFrameSourcesConstructor frame_sources_constructor(
197 task_runner.get(), now_src);
198 return make_scoped_ptr(new TestScheduler(
199 now_src,
200 client,
201 scheduler_settings,
202 layer_tree_host_id,
203 task_runner,
204 &frame_sources_constructor,
205 external_begin_frame_source.Pass()));
206 }
207 171
208 // Extra test helper functionality 172 // Extra test helper functionality
209 bool IsBeginRetroFrameArgsEmpty() const { 173 bool IsBeginRetroFrameArgsEmpty() const {
210 return begin_retro_frame_args_.empty(); 174 return begin_retro_frame_args_.empty();
211 } 175 }
212 176
213 bool CanStart() const { return state_machine_.CanStartForTesting(); } 177 bool CanStart() const { return state_machine_.CanStartForTesting(); }
214 178
215 BeginFrameSource& frame_source() { return *frame_source_; } 179 BeginFrameSource& frame_source() { return *frame_source_; }
216 bool FrameProductionThrottled() { return throttle_frame_production_; } 180 bool FrameProductionThrottled() { return throttle_frame_production_; }
217 181
218 ~TestScheduler() override; 182 ~TestScheduler() override;
219 183
220 base::TimeDelta BeginImplFrameInterval() { 184 base::TimeDelta BeginImplFrameInterval() {
221 return begin_impl_frame_tracker_.Interval(); 185 return begin_impl_frame_tracker_.Interval();
222 } 186 }
223 187
224 protected: 188 protected:
225 // Overridden from Scheduler. 189 // Overridden from Scheduler.
226 base::TimeTicks Now() const override; 190 base::TimeTicks Now() const override;
227 191
228 private: 192 private:
229 TestScheduler(base::SimpleTestTickClock* now_src, 193 TestScheduler(
230 SchedulerClient* client, 194 base::SimpleTestTickClock* now_src,
231 const SchedulerSettings& scheduler_settings, 195 SchedulerClient* client,
232 int layer_tree_host_id, 196 const SchedulerSettings& scheduler_settings,
233 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, 197 int layer_tree_host_id,
234 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, 198 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner,
235 scoped_ptr<BeginFrameSource> external_begin_frame_source); 199 BeginFrameSource* external_frame_source,
200 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
201 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source);
236 202
237 // Not owned. 203 // Not owned.
238 base::SimpleTestTickClock* now_src_; 204 base::SimpleTestTickClock* now_src_;
239 205
240 DISALLOW_COPY_AND_ASSIGN(TestScheduler); 206 DISALLOW_COPY_AND_ASSIGN(TestScheduler);
241 }; 207 };
242 208
243 } // namespace cc 209 } // namespace cc
244 210
245 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ 211 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/surfaces/onscreen_display_client.cc ('k') | cc/test/scheduler_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698