| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 12 #include "base/sequence_checker.h" |
| 13 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" |
| 14 #include "cc/scheduler/begin_frame_source.h" | 14 #include "cc/scheduler/begin_frame_source.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class SimpleTestTickClock; | 17 class SimpleTestTickClock; |
| 18 } // namespace base | 18 } // namespace base |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class FakeExternalBeginFrameSource | 22 class FakeExternalBeginFrameSource : public BeginFrameSource { |
| 23 : public BeginFrameSource, | |
| 24 public NON_EXPORTED_BASE(base::NonThreadSafe) { | |
| 25 public: | 23 public: |
| 26 class Client { | 24 class Client { |
| 27 public: | 25 public: |
| 28 virtual void OnAddObserver(BeginFrameObserver* obs) = 0; | 26 virtual void OnAddObserver(BeginFrameObserver* obs) = 0; |
| 29 virtual void OnRemoveObserver(BeginFrameObserver* obs) = 0; | 27 virtual void OnRemoveObserver(BeginFrameObserver* obs) = 0; |
| 30 }; | 28 }; |
| 31 | 29 |
| 32 explicit FakeExternalBeginFrameSource(double refresh_rate, | 30 explicit FakeExternalBeginFrameSource(double refresh_rate, |
| 33 bool tick_automatically); | 31 bool tick_automatically); |
| 34 ~FakeExternalBeginFrameSource() override; | 32 ~FakeExternalBeginFrameSource() override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 void PostTestOnBeginFrame(); | 54 void PostTestOnBeginFrame(); |
| 57 | 55 |
| 58 const bool tick_automatically_; | 56 const bool tick_automatically_; |
| 59 const double milliseconds_per_frame_; | 57 const double milliseconds_per_frame_; |
| 60 Client* client_ = nullptr; | 58 Client* client_ = nullptr; |
| 61 bool paused_ = false; | 59 bool paused_ = false; |
| 62 BeginFrameArgs current_args_; | 60 BeginFrameArgs current_args_; |
| 63 uint64_t next_begin_frame_number_ = BeginFrameArgs::kStartingFrameNumber; | 61 uint64_t next_begin_frame_number_ = BeginFrameArgs::kStartingFrameNumber; |
| 64 std::set<BeginFrameObserver*> observers_; | 62 std::set<BeginFrameObserver*> observers_; |
| 65 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; | 63 base::CancelableCallback<void(const BeginFrameArgs&)> begin_frame_task_; |
| 64 |
| 65 SEQUENCE_CHECKER(sequence_checker_); |
| 66 |
| 66 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; | 67 base::WeakPtrFactory<FakeExternalBeginFrameSource> weak_ptr_factory_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace cc | 70 } // namespace cc |
| 70 | 71 |
| 71 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ | 72 #endif // CC_TEST_FAKE_EXTERNAL_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |