| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 DISALLOW_COPY_AND_ASSIGN(TestDelayBasedTimeSource); | 87 DISALLOW_COPY_AND_ASSIGN(TestDelayBasedTimeSource); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class FakeBeginFrameSource : public BeginFrameSourceBase { | 90 class FakeBeginFrameSource : public BeginFrameSourceBase { |
| 91 public: | 91 public: |
| 92 FakeBeginFrameSource() : remaining_frames_(false) {} | 92 FakeBeginFrameSource() : remaining_frames_(false) {} |
| 93 ~FakeBeginFrameSource() override {} | 93 ~FakeBeginFrameSource() override {} |
| 94 | 94 |
| 95 BeginFrameObserver* GetObserver() { return observer_; } | 95 BeginFrameObserver* GetObserver() { |
| 96 if ((observer_list_).might_have_observers()) { |
| 97 base::ObserverList<BeginFrameObserver>::Iterator it(&observer_list_); |
| 98 BeginFrameObserver* obs; |
| 99 while ((obs = it.GetNext()) != nullptr) { |
| 100 return obs; |
| 101 } |
| 102 } |
| 103 return nullptr; |
| 104 } |
| 96 | 105 |
| 97 BeginFrameArgs TestLastUsedBeginFrameArgs() { | 106 BeginFrameArgs TestLastUsedBeginFrameArgs() { |
| 98 if (observer_) { | 107 BeginFrameObserver* obs = GetObserver(); |
| 99 return observer_->LastUsedBeginFrameArgs(); | 108 if (obs) { |
| 109 return obs->LastUsedBeginFrameArgs(); |
| 100 } | 110 } |
| 101 return BeginFrameArgs(); | 111 return BeginFrameArgs(); |
| 102 } | 112 } |
| 103 | 113 |
| 104 void TestOnBeginFrame(const BeginFrameArgs& args) { | 114 void TestOnBeginFrame(const BeginFrameArgs& args) { |
| 105 return CallOnBeginFrame(args); | 115 return CallOnBeginFrame(args); |
| 106 } | 116 } |
| 107 | 117 |
| 108 // BeginFrameSource | 118 // BeginFrameSource |
| 109 void DidFinishFrame(size_t remaining_frames) override; | 119 void DidFinishFrame(size_t remaining_frames) override; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 scoped_ptr<CompositorTimingHistory> compositor_timing_history); | 261 scoped_ptr<CompositorTimingHistory> compositor_timing_history); |
| 252 | 262 |
| 253 base::SimpleTestTickClock* now_src_; | 263 base::SimpleTestTickClock* now_src_; |
| 254 | 264 |
| 255 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 265 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
| 256 }; | 266 }; |
| 257 | 267 |
| 258 } // namespace cc | 268 } // namespace cc |
| 259 | 269 |
| 260 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 270 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |