| 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 CCScheduler_h | 5 #ifndef CCScheduler_h |
| 6 #define CCScheduler_h | 6 #define CCScheduler_h |
| 7 | 7 |
| 8 #include "CCFrameRateController.h" | 8 #include "CCFrameRateController.h" |
| 9 #include "CCSchedulerStateMachine.h" | 9 #include "CCSchedulerStateMachine.h" |
| 10 | 10 #include "base/time.h" |
| 11 #include <wtf/Noncopyable.h> | 11 #include <wtf/Noncopyable.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 | 17 |
| 18 struct CCScheduledActionDrawAndSwapResult { | 18 struct CCScheduledActionDrawAndSwapResult { |
| 19 CCScheduledActionDrawAndSwapResult() | 19 CCScheduledActionDrawAndSwapResult() |
| 20 : didDraw(false) | 20 : didDraw(false) |
| 21 , didSwap(false) | 21 , didSwap(false) |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 CCScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) | 24 CCScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap) |
| 25 : didDraw(didDraw) | 25 : didDraw(didDraw) |
| 26 , didSwap(didSwap) | 26 , didSwap(didSwap) |
| 27 { | 27 { |
| 28 } | 28 } |
| 29 bool didDraw; | 29 bool didDraw; |
| 30 bool didSwap; | 30 bool didSwap; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class CCSchedulerClient { | 33 class CCSchedulerClient { |
| 34 public: | 34 public: |
| 35 virtual void scheduledActionBeginFrame() = 0; | 35 virtual void scheduledActionBeginFrame() = 0; |
| 36 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() = 0; | 36 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() = 0; |
| 37 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) = 0; | 37 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) = 0; |
| 38 virtual void scheduledActionUpdateMoreResources(double monotonicTimeLimit) =
0; | 38 virtual void scheduledActionUpdateMoreResources(base::TimeTicks timeLimit) =
0; |
| 39 virtual void scheduledActionCommit() = 0; | 39 virtual void scheduledActionCommit() = 0; |
| 40 virtual void scheduledActionBeginContextRecreation() = 0; | 40 virtual void scheduledActionBeginContextRecreation() = 0; |
| 41 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; | 41 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 virtual ~CCSchedulerClient() { } | 44 virtual ~CCSchedulerClient() { } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class CCScheduler : CCFrameRateControllerClient { | 47 class CCScheduler : CCFrameRateControllerClient { |
| 48 WTF_MAKE_NONCOPYABLE(CCScheduler); | 48 WTF_MAKE_NONCOPYABLE(CCScheduler); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 77 void setMaxFramesPending(int); | 77 void setMaxFramesPending(int); |
| 78 void setSwapBuffersCompleteSupported(bool); | 78 void setSwapBuffersCompleteSupported(bool); |
| 79 void didSwapBuffersComplete(); | 79 void didSwapBuffersComplete(); |
| 80 | 80 |
| 81 void didLoseContext(); | 81 void didLoseContext(); |
| 82 void didRecreateContext(); | 82 void didRecreateContext(); |
| 83 | 83 |
| 84 bool commitPending() const { return m_stateMachine.commitPending(); } | 84 bool commitPending() const { return m_stateMachine.commitPending(); } |
| 85 bool redrawPending() const { return m_stateMachine.redrawPending(); } | 85 bool redrawPending() const { return m_stateMachine.redrawPending(); } |
| 86 | 86 |
| 87 void setTimebaseAndInterval(double timebase, double intervalSeconds); | 87 void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interv
al); |
| 88 | 88 |
| 89 // CCFrameRateControllerClient implementation | 89 // CCFrameRateControllerClient implementation |
| 90 virtual void vsyncTick() OVERRIDE; | 90 virtual void vsyncTick() OVERRIDE; |
| 91 | 91 |
| 92 void updateResourcesComplete(); | 92 void updateResourcesComplete(); |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>); | 95 CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>); |
| 96 | 96 |
| 97 void processScheduledActions(); | 97 void processScheduledActions(); |
| 98 | 98 |
| 99 CCSchedulerClient* m_client; | 99 CCSchedulerClient* m_client; |
| 100 OwnPtr<CCFrameRateController> m_frameRateController; | 100 OwnPtr<CCFrameRateController> m_frameRateController; |
| 101 CCSchedulerStateMachine m_stateMachine; | 101 CCSchedulerStateMachine m_stateMachine; |
| 102 bool m_updateResourcesCompletePending; | 102 bool m_updateResourcesCompletePending; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } | 105 } |
| 106 | 106 |
| 107 #endif // CCScheduler_h | 107 #endif // CCScheduler_h |
| OLD | NEW |