OLD | NEW |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 private: | 160 private: |
161 DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource); | 161 DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource); |
162 }; | 162 }; |
163 | 163 |
164 class FakeCompositorTimingHistory : public CompositorTimingHistory { | 164 class FakeCompositorTimingHistory : public CompositorTimingHistory { |
165 public: | 165 public: |
166 static scoped_ptr<FakeCompositorTimingHistory> Create(); | 166 static scoped_ptr<FakeCompositorTimingHistory> Create(); |
167 ~FakeCompositorTimingHistory() override; | 167 ~FakeCompositorTimingHistory() override; |
168 | 168 |
| 169 void SetAllEstimatesTo(base::TimeDelta duration); |
| 170 |
169 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration); | 171 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration); |
170 void SetCommitToReadyToActivateDurationEstimate(base::TimeDelta duration); | 172 void SetCommitToReadyToActivateDurationEstimate(base::TimeDelta duration); |
171 void SetPrepareTilesDurationEstimate(base::TimeDelta duration); | 173 void SetPrepareTilesDurationEstimate(base::TimeDelta duration); |
172 void SetActivateDurationEstimate(base::TimeDelta duration); | 174 void SetActivateDurationEstimate(base::TimeDelta duration); |
173 void SetDrawDurationEstimate(base::TimeDelta duration); | 175 void SetDrawDurationEstimate(base::TimeDelta duration); |
174 | 176 |
175 base::TimeDelta BeginMainFrameToCommitDurationEstimate() const override; | 177 base::TimeDelta BeginMainFrameToCommitDurationEstimate() const override; |
176 base::TimeDelta CommitToReadyToActivateDurationEstimate() const override; | 178 base::TimeDelta CommitToReadyToActivateDurationEstimate() const override; |
177 base::TimeDelta PrepareTilesDurationEstimate() const override; | 179 base::TimeDelta PrepareTilesDurationEstimate() const override; |
178 base::TimeDelta ActivateDurationEstimate() const override; | 180 base::TimeDelta ActivateDurationEstimate() const override; |
(...skipping 27 matching lines...) Expand all Loading... |
206 BeginFrameSource* external_frame_source, | 208 BeginFrameSource* external_frame_source, |
207 scoped_ptr<CompositorTimingHistory> compositor_timing_history); | 209 scoped_ptr<CompositorTimingHistory> compositor_timing_history); |
208 | 210 |
209 // Extra test helper functionality | 211 // Extra test helper functionality |
210 bool IsBeginRetroFrameArgsEmpty() const { | 212 bool IsBeginRetroFrameArgsEmpty() const { |
211 return begin_retro_frame_args_.empty(); | 213 return begin_retro_frame_args_.empty(); |
212 } | 214 } |
213 | 215 |
214 bool CanStart() const { return state_machine_.CanStartForTesting(); } | 216 bool CanStart() const { return state_machine_.CanStartForTesting(); } |
215 | 217 |
| 218 bool NeedsCommit() const { return state_machine_.needs_commit(); } |
| 219 |
216 BeginFrameSource& frame_source() { return *frame_source_; } | 220 BeginFrameSource& frame_source() { return *frame_source_; } |
217 bool FrameProductionThrottled() { return throttle_frame_production_; } | 221 bool FrameProductionThrottled() { return throttle_frame_production_; } |
218 | 222 |
| 223 bool MainThreadIsInHighLatencyMode() const { |
| 224 return state_machine_.MainThreadIsInHighLatencyMode(); |
| 225 } |
| 226 |
219 ~TestScheduler() override; | 227 ~TestScheduler() override; |
220 | 228 |
221 base::TimeDelta BeginImplFrameInterval() { | 229 base::TimeDelta BeginImplFrameInterval() { |
222 return begin_impl_frame_tracker_.Interval(); | 230 return begin_impl_frame_tracker_.Interval(); |
223 } | 231 } |
224 | 232 |
225 protected: | 233 protected: |
226 // Overridden from Scheduler. | 234 // Overridden from Scheduler. |
227 base::TimeTicks Now() const override; | 235 base::TimeTicks Now() const override; |
228 | 236 |
(...skipping 10 matching lines...) Expand all Loading... |
239 scoped_ptr<CompositorTimingHistory> compositor_timing_history); | 247 scoped_ptr<CompositorTimingHistory> compositor_timing_history); |
240 | 248 |
241 base::SimpleTestTickClock* now_src_; | 249 base::SimpleTestTickClock* now_src_; |
242 | 250 |
243 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 251 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
244 }; | 252 }; |
245 | 253 |
246 } // namespace cc | 254 } // namespace cc |
247 | 255 |
248 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 256 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
OLD | NEW |