| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 bool NeedsBeginMainFrame() const { | 231 bool NeedsBeginMainFrame() const { |
| 232 return state_machine_.needs_begin_main_frame(); | 232 return state_machine_.needs_begin_main_frame(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 BeginFrameSource& frame_source() { return *begin_frame_source_; } | 235 BeginFrameSource& frame_source() { return *begin_frame_source_; } |
| 236 | 236 |
| 237 bool MainThreadMissedLastDeadline() const { | 237 bool MainThreadMissedLastDeadline() const { |
| 238 return state_machine_.main_thread_missed_last_deadline(); | 238 return state_machine_.main_thread_missed_last_deadline(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool begin_frames_expected() const { return observing_begin_frame_source_; } | 241 bool begin_frames_expected() const { |
| 242 return begin_frame_source_ && observing_begin_frame_source_; |
| 243 } |
| 242 | 244 |
| 243 ~TestScheduler() override; | 245 ~TestScheduler() override; |
| 244 | 246 |
| 245 base::TimeDelta BeginImplFrameInterval() { | 247 base::TimeDelta BeginImplFrameInterval() { |
| 246 return begin_impl_frame_tracker_.Interval(); | 248 return begin_impl_frame_tracker_.Interval(); |
| 247 } | 249 } |
| 248 | 250 |
| 249 // Note: This setting will be overriden on the next BeginFrame in the | 251 // Note: This setting will be overriden on the next BeginFrame in the |
| 250 // scheduler. To control the value it gets on the next BeginFrame | 252 // scheduler. To control the value it gets on the next BeginFrame |
| 251 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame | 253 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame |
| 252 // to Activation is fast. | 254 // to Activation is fast. |
| 253 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) { | 255 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) { |
| 254 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast); | 256 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast); |
| 255 } | 257 } |
| 256 | 258 |
| 257 protected: | 259 protected: |
| 258 // Overridden from Scheduler. | 260 // Overridden from Scheduler. |
| 259 base::TimeTicks Now() const override; | 261 base::TimeTicks Now() const override; |
| 260 | 262 |
| 261 private: | 263 private: |
| 262 base::SimpleTestTickClock* now_src_; | 264 base::SimpleTestTickClock* now_src_; |
| 263 | 265 |
| 264 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 266 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
| 265 }; | 267 }; |
| 266 | 268 |
| 267 } // namespace cc | 269 } // namespace cc |
| 268 | 270 |
| 269 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 271 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |