| 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 CCFrameRateController_h | 5 #ifndef CCFrameRateController_h |
| 6 #define CCFrameRateController_h | 6 #define CCFrameRateController_h |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "cc/cc_export.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 class Thread; | 16 class Thread; |
| 16 class TimeSource; | 17 class TimeSource; |
| 17 | 18 |
| 18 class FrameRateControllerClient { | 19 class CC_EXPORT FrameRateControllerClient { |
| 19 public: | 20 public: |
| 20 // Throttled is true when we have a maximum number of frames pending. | 21 // Throttled is true when we have a maximum number of frames pending. |
| 21 virtual void vsyncTick(bool throttled) = 0; | 22 virtual void vsyncTick(bool throttled) = 0; |
| 22 | 23 |
| 23 protected: | 24 protected: |
| 24 virtual ~FrameRateControllerClient() {} | 25 virtual ~FrameRateControllerClient() {} |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 class FrameRateControllerTimeSourceAdapter; | 28 class FrameRateControllerTimeSourceAdapter; |
| 28 | 29 |
| 29 class FrameRateController { | 30 class CC_EXPORT FrameRateController { |
| 30 public: | 31 public: |
| 31 explicit FrameRateController(scoped_refptr<TimeSource>); | 32 explicit FrameRateController(scoped_refptr<TimeSource>); |
| 32 // Alternate form of FrameRateController with unthrottled frame-rate. | 33 // Alternate form of FrameRateController with unthrottled frame-rate. |
| 33 explicit FrameRateController(Thread*); | 34 explicit FrameRateController(Thread*); |
| 34 virtual ~FrameRateController(); | 35 virtual ~FrameRateController(); |
| 35 | 36 |
| 36 void setClient(FrameRateControllerClient* client) { m_client = client; } | 37 void setClient(FrameRateControllerClient* client) { m_client = client; } |
| 37 | 38 |
| 38 void setActive(bool); | 39 void setActive(bool); |
| 39 | 40 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 bool m_isTimeSourceThrottling; | 74 bool m_isTimeSourceThrottling; |
| 74 base::WeakPtrFactory<FrameRateController> m_weakFactory; | 75 base::WeakPtrFactory<FrameRateController> m_weakFactory; |
| 75 Thread* m_thread; | 76 Thread* m_thread; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(FrameRateController); | 78 DISALLOW_COPY_AND_ASSIGN(FrameRateController); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace cc | 81 } // namespace cc |
| 81 | 82 |
| 82 #endif // CCFrameRateController_h | 83 #endif // CCFrameRateController_h |
| OLD | NEW |