| 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 <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 bool tick_called_; | 35 bool tick_called_; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSourceClient); | 38 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSourceClient); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class FakeDelayBasedTimeSource : public DelayBasedTimeSource { | 41 class FakeDelayBasedTimeSource : public DelayBasedTimeSource { |
| 42 public: | 42 public: |
| 43 static std::unique_ptr<FakeDelayBasedTimeSource> Create( | 43 explicit FakeDelayBasedTimeSource(base::SingleThreadTaskRunner* task_runner) |
| 44 base::TimeDelta interval, | 44 : DelayBasedTimeSource(task_runner) {} |
| 45 base::SingleThreadTaskRunner* task_runner) { | |
| 46 return base::WrapUnique( | |
| 47 new FakeDelayBasedTimeSource(interval, task_runner)); | |
| 48 } | |
| 49 | |
| 50 ~FakeDelayBasedTimeSource() override {} | 45 ~FakeDelayBasedTimeSource() override {} |
| 51 | 46 |
| 52 void SetNow(base::TimeTicks time) { now_ = time; } | 47 void SetNow(base::TimeTicks time) { now_ = time; } |
| 53 base::TimeTicks Now() const override; | 48 base::TimeTicks Now() const override; |
| 54 | 49 |
| 55 protected: | 50 protected: |
| 56 FakeDelayBasedTimeSource(base::TimeDelta interval, | |
| 57 base::SingleThreadTaskRunner* task_runner) | |
| 58 : DelayBasedTimeSource(interval, task_runner) {} | |
| 59 | |
| 60 base::TimeTicks now_; | 51 base::TimeTicks now_; |
| 61 | 52 |
| 62 private: | 53 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSource); | 54 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSource); |
| 64 }; | 55 }; |
| 65 | 56 |
| 66 class TestDelayBasedTimeSource : public DelayBasedTimeSource { | 57 class TestDelayBasedTimeSource : public DelayBasedTimeSource { |
| 67 public: | 58 public: |
| 68 static std::unique_ptr<TestDelayBasedTimeSource> Create( | 59 TestDelayBasedTimeSource(base::SimpleTestTickClock* now_src, |
| 69 base::SimpleTestTickClock* now_src, | 60 OrderedSimpleTaskRunner* task_runner); |
| 70 base::TimeDelta interval, | |
| 71 OrderedSimpleTaskRunner* task_runner) { | |
| 72 return base::WrapUnique( | |
| 73 new TestDelayBasedTimeSource(now_src, interval, task_runner)); | |
| 74 } | |
| 75 | |
| 76 ~TestDelayBasedTimeSource() override; | 61 ~TestDelayBasedTimeSource() override; |
| 77 | 62 |
| 78 protected: | 63 protected: |
| 79 TestDelayBasedTimeSource(base::SimpleTestTickClock* now_src, | |
| 80 base::TimeDelta interval, | |
| 81 OrderedSimpleTaskRunner* task_runner); | |
| 82 | |
| 83 // Overridden from DelayBasedTimeSource | 64 // Overridden from DelayBasedTimeSource |
| 84 base::TimeTicks Now() const override; | 65 base::TimeTicks Now() const override; |
| 85 std::string TypeString() const override; | 66 std::string TypeString() const override; |
| 86 | 67 |
| 87 // Not owned. | 68 // Not owned. |
| 88 base::SimpleTestTickClock* now_src_; | 69 base::SimpleTestTickClock* now_src_; |
| 89 | 70 |
| 90 private: | 71 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(TestDelayBasedTimeSource); | 72 DISALLOW_COPY_AND_ASSIGN(TestDelayBasedTimeSource); |
| 92 }; | 73 }; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 108 } | 89 } |
| 109 | 90 |
| 110 bool has_observers() const { return !observers_.empty(); } | 91 bool has_observers() const { return !observers_.empty(); } |
| 111 | 92 |
| 112 using BeginFrameSourceBase::SetBeginFrameSourcePaused; | 93 using BeginFrameSourceBase::SetBeginFrameSourcePaused; |
| 113 | 94 |
| 114 private: | 95 private: |
| 115 DISALLOW_COPY_AND_ASSIGN(FakeBeginFrameSource); | 96 DISALLOW_COPY_AND_ASSIGN(FakeBeginFrameSource); |
| 116 }; | 97 }; |
| 117 | 98 |
| 118 class TestBackToBackBeginFrameSource : public BackToBackBeginFrameSource { | |
| 119 public: | |
| 120 TestBackToBackBeginFrameSource(base::SimpleTestTickClock* now_src, | |
| 121 base::SingleThreadTaskRunner* task_runner); | |
| 122 ~TestBackToBackBeginFrameSource() override; | |
| 123 | |
| 124 protected: | |
| 125 base::TimeTicks Now() override; | |
| 126 // Not owned. | |
| 127 base::SimpleTestTickClock* now_src_; | |
| 128 | |
| 129 private: | |
| 130 DISALLOW_COPY_AND_ASSIGN(TestBackToBackBeginFrameSource); | |
| 131 }; | |
| 132 | |
| 133 class TestSyntheticBeginFrameSource : public SyntheticBeginFrameSource { | |
| 134 public: | |
| 135 explicit TestSyntheticBeginFrameSource(base::SimpleTestTickClock* now_src, | |
| 136 OrderedSimpleTaskRunner* task_runner, | |
| 137 base::TimeDelta initial_interval); | |
| 138 ~TestSyntheticBeginFrameSource() override; | |
| 139 | |
| 140 private: | |
| 141 DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource); | |
| 142 }; | |
| 143 | |
| 144 class FakeCompositorTimingHistory : public CompositorTimingHistory { | 99 class FakeCompositorTimingHistory : public CompositorTimingHistory { |
| 145 public: | 100 public: |
| 146 static std::unique_ptr<FakeCompositorTimingHistory> Create( | 101 static std::unique_ptr<FakeCompositorTimingHistory> Create( |
| 147 bool using_synchronous_renderer_compositor); | 102 bool using_synchronous_renderer_compositor); |
| 148 ~FakeCompositorTimingHistory() override; | 103 ~FakeCompositorTimingHistory() override; |
| 149 | 104 |
| 150 void SetAllEstimatesTo(base::TimeDelta duration); | 105 void SetAllEstimatesTo(base::TimeDelta duration); |
| 151 | 106 |
| 152 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration); | 107 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration); |
| 153 void SetBeginMainFrameQueueDurationCriticalEstimate(base::TimeDelta duration); | 108 void SetBeginMainFrameQueueDurationCriticalEstimate(base::TimeDelta duration); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 197 |
| 243 private: | 198 private: |
| 244 base::SimpleTestTickClock* now_src_; | 199 base::SimpleTestTickClock* now_src_; |
| 245 | 200 |
| 246 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 201 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
| 247 }; | 202 }; |
| 248 | 203 |
| 249 } // namespace cc | 204 } // namespace cc |
| 250 | 205 |
| 251 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 206 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |