| 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 |
| 227 bool WasSwapThrottledAtLastBeginFrame() const { |
| 228 return was_swap_throttled_at_last_begin_frame_; |
| 229 } |
| 230 |
| 219 ~TestScheduler() override; | 231 ~TestScheduler() override; |
| 220 | 232 |
| 221 base::TimeDelta BeginImplFrameInterval() { | 233 base::TimeDelta BeginImplFrameInterval() { |
| 222 return begin_impl_frame_tracker_.Interval(); | 234 return begin_impl_frame_tracker_.Interval(); |
| 223 } | 235 } |
| 224 | 236 |
| 225 protected: | 237 protected: |
| 226 // Overridden from Scheduler. | 238 // Overridden from Scheduler. |
| 227 base::TimeTicks Now() const override; | 239 base::TimeTicks Now() const override; |
| 240 void BeginImplFrameWithDeadline(const BeginFrameArgs& args) override; |
| 228 | 241 |
| 229 private: | 242 private: |
| 230 TestScheduler( | 243 TestScheduler( |
| 231 base::SimpleTestTickClock* now_src, | 244 base::SimpleTestTickClock* now_src, |
| 232 SchedulerClient* client, | 245 SchedulerClient* client, |
| 233 const SchedulerSettings& scheduler_settings, | 246 const SchedulerSettings& scheduler_settings, |
| 234 int layer_tree_host_id, | 247 int layer_tree_host_id, |
| 235 OrderedSimpleTaskRunner* task_runner, | 248 OrderedSimpleTaskRunner* task_runner, |
| 236 BeginFrameSource* external_frame_source, | 249 BeginFrameSource* external_frame_source, |
| 237 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source, | 250 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source, |
| 238 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, | 251 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, |
| 239 scoped_ptr<CompositorTimingHistory> compositor_timing_history); | 252 scoped_ptr<CompositorTimingHistory> compositor_timing_history); |
| 240 | 253 |
| 241 base::SimpleTestTickClock* now_src_; | 254 base::SimpleTestTickClock* now_src_; |
| 255 bool was_swap_throttled_at_last_begin_frame_; |
| 242 | 256 |
| 243 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 257 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
| 244 }; | 258 }; |
| 245 | 259 |
| 246 } // namespace cc | 260 } // namespace cc |
| 247 | 261 |
| 248 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 262 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |