| 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 "CCTimer.h" | 8 #include "CCTimer.h" |
| 9 | 9 #include "base/time.h" |
| 10 #include <wtf/Deque.h> | 10 #include <wtf/Deque.h> |
| 11 #include <wtf/OwnPtr.h> | 11 #include <wtf/OwnPtr.h> |
| 12 #include <wtf/PassOwnPtr.h> | 12 #include <wtf/PassOwnPtr.h> |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class CCThread; | 16 class CCThread; |
| 17 class CCTimeSource; | 17 class CCTimeSource; |
| 18 | 18 |
| 19 class CCFrameRateControllerClient { | 19 class CCFrameRateControllerClient { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 // Use the following methods to adjust target frame rate. | 40 // Use the following methods to adjust target frame rate. |
| 41 // | 41 // |
| 42 // Multiple frames can be in-progress, but for every didBeginFrame, a | 42 // Multiple frames can be in-progress, but for every didBeginFrame, a |
| 43 // didFinishFrame should be posted. | 43 // didFinishFrame should be posted. |
| 44 // | 44 // |
| 45 // If the rendering pipeline crashes, call didAbortAllPendingFrames. | 45 // If the rendering pipeline crashes, call didAbortAllPendingFrames. |
| 46 void didBeginFrame(); | 46 void didBeginFrame(); |
| 47 void didFinishFrame(); | 47 void didFinishFrame(); |
| 48 void didAbortAllPendingFrames(); | 48 void didAbortAllPendingFrames(); |
| 49 void setMaxFramesPending(int); // 0 for unlimited. | 49 void setMaxFramesPending(int); // 0 for unlimited. |
| 50 double nextTickTimeIfActivated(); | 50 base::TimeTicks nextTickTimeIfActivated(); |
| 51 | 51 |
| 52 void setTimebaseAndInterval(double timebase, double intervalSeconds); | 52 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); |
| 53 void setSwapBuffersCompleteSupported(bool); | 53 void setSwapBuffersCompleteSupported(bool); |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 friend class CCFrameRateControllerTimeSourceAdapter; | 56 friend class CCFrameRateControllerTimeSourceAdapter; |
| 57 void onTimerTick(); | 57 void onTimerTick(); |
| 58 | 58 |
| 59 void postManualTick(); | 59 void postManualTick(); |
| 60 | 60 |
| 61 // CCTimerClient implementation (used for unthrottled frame-rate). | 61 // CCTimerClient implementation (used for unthrottled frame-rate). |
| 62 virtual void onTimerFired() OVERRIDE; | 62 virtual void onTimerFired() OVERRIDE; |
| 63 | 63 |
| 64 CCFrameRateControllerClient* m_client; | 64 CCFrameRateControllerClient* m_client; |
| 65 int m_numFramesPending; | 65 int m_numFramesPending; |
| 66 int m_maxFramesPending; | 66 int m_maxFramesPending; |
| 67 RefPtr<CCTimeSource> m_timeSource; | 67 RefPtr<CCTimeSource> m_timeSource; |
| 68 OwnPtr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; | 68 OwnPtr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter; |
| 69 bool m_active; | 69 bool m_active; |
| 70 bool m_swapBuffersCompleteSupported; | 70 bool m_swapBuffersCompleteSupported; |
| 71 | 71 |
| 72 // Members for unthrottled frame-rate. | 72 // Members for unthrottled frame-rate. |
| 73 bool m_isTimeSourceThrottling; | 73 bool m_isTimeSourceThrottling; |
| 74 OwnPtr<CCTimer> m_manualTicker; | 74 OwnPtr<CCTimer> m_manualTicker; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } | 77 } |
| 78 #endif // CCFrameRateController_h | 78 #endif // CCFrameRateController_h |
| OLD | NEW |