OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 5 #ifndef CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
6 #define CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 6 #define CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 void SetPaused(bool paused); | 31 void SetPaused(bool paused); |
32 | 32 |
33 // BeginFrameSource implementation. | 33 // BeginFrameSource implementation. |
34 void AddObserver(BeginFrameObserver* obs) override; | 34 void AddObserver(BeginFrameObserver* obs) override; |
35 void RemoveObserver(BeginFrameObserver* obs) override; | 35 void RemoveObserver(BeginFrameObserver* obs) override; |
36 void DidFinishFrame(BeginFrameObserver* obs, | 36 void DidFinishFrame(BeginFrameObserver* obs, |
37 size_t remaining_frames) override {} | 37 size_t remaining_frames) override {} |
38 | 38 |
39 void TestOnBeginFrame(const BeginFrameArgs& args); | 39 void TestOnBeginFrame(const BeginFrameArgs& args); |
40 | 40 |
| 41 size_t num_observers() const { return observers_.size(); } |
| 42 |
41 private: | 43 private: |
42 void PostTestOnBeginFrame(); | 44 void PostTestOnBeginFrame(); |
43 | 45 |
44 const bool tick_automatically_; | 46 const bool tick_automatically_; |
45 const double milliseconds_per_frame_; | 47 const double milliseconds_per_frame_; |
46 Client* client_ = nullptr; | 48 Client* client_ = nullptr; |
47 bool paused_ = false; | 49 bool paused_ = false; |
48 std::set<BeginFrameObserver*> observers_; | 50 std::set<BeginFrameObserver*> observers_; |
49 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; | 51 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; |
50 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; | 52 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; |
51 }; | 53 }; |
52 | 54 |
53 } // namespace cc | 55 } // namespace cc |
54 | 56 |
55 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 57 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |