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 17 matching lines...) Expand all Loading... |
28 bool tick_automatically); | 28 bool tick_automatically); |
29 ~FakeExternalBeginFrameSource() override; | 29 ~FakeExternalBeginFrameSource() override; |
30 | 30 |
31 void SetClient(Client* client) { client_ = client; } | 31 void SetClient(Client* client) { client_ = client; } |
32 void SetPaused(bool paused); | 32 void SetPaused(bool paused); |
33 | 33 |
34 // BeginFrameSource implementation. | 34 // BeginFrameSource implementation. |
35 void AddObserver(BeginFrameObserver* obs) override; | 35 void AddObserver(BeginFrameObserver* obs) override; |
36 void RemoveObserver(BeginFrameObserver* obs) override; | 36 void RemoveObserver(BeginFrameObserver* obs) override; |
37 void DidFinishFrame(BeginFrameObserver* obs, | 37 void DidFinishFrame(BeginFrameObserver* obs, |
38 size_t remaining_frames) override {} | 38 const BeginFrameAck& ack) override {} |
39 bool IsThrottled() const override; | 39 bool IsThrottled() const override; |
40 | 40 |
41 void TestOnBeginFrame(const BeginFrameArgs& args); | 41 void TestOnBeginFrame(const BeginFrameArgs& args); |
42 | 42 |
43 size_t num_observers() const { return observers_.size(); } | 43 size_t num_observers() const { return observers_.size(); } |
44 | 44 |
45 private: | 45 private: |
46 void PostTestOnBeginFrame(); | 46 void PostTestOnBeginFrame(); |
47 | 47 |
48 const bool tick_automatically_; | 48 const bool tick_automatically_; |
49 const double milliseconds_per_frame_; | 49 const double milliseconds_per_frame_; |
50 Client* client_ = nullptr; | 50 Client* client_ = nullptr; |
51 bool paused_ = false; | 51 bool paused_ = false; |
| 52 uint64_t next_begin_frame_number_ = 1; |
52 std::set<BeginFrameObserver*> observers_; | 53 std::set<BeginFrameObserver*> observers_; |
53 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; | 54 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; |
54 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; | 55 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; |
55 }; | 56 }; |
56 | 57 |
57 } // namespace cc | 58 } // namespace cc |
58 | 59 |
59 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 60 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |