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 |
(...skipping 15 matching lines...) Expand all Loading... |
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 bool canDraw() = 0; | 35 virtual bool canDraw() = 0; |
| 36 virtual bool hasMoreResourceUpdates() const = 0; |
36 | 37 |
37 virtual void scheduledActionBeginFrame() = 0; | 38 virtual void scheduledActionBeginFrame() = 0; |
38 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() = 0; | 39 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() = 0; |
39 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) = 0; | 40 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) = 0; |
40 virtual void scheduledActionUpdateMoreResources(double monotonicTimeLimit) =
0; | 41 virtual void scheduledActionUpdateMoreResources(double monotonicTimeLimit) =
0; |
41 virtual void scheduledActionCommit() = 0; | 42 virtual void scheduledActionCommit() = 0; |
42 virtual void scheduledActionBeginContextRecreation() = 0; | 43 virtual void scheduledActionBeginContextRecreation() = 0; |
43 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; | 44 virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0; |
44 | 45 |
45 protected: | 46 protected: |
(...skipping 19 matching lines...) Expand all Loading... |
65 // Like setNeedsCommit(), but ensures a commit will definitely happen even i
f we are not visible. | 66 // Like setNeedsCommit(), but ensures a commit will definitely happen even i
f we are not visible. |
66 void setNeedsForcedCommit(); | 67 void setNeedsForcedCommit(); |
67 | 68 |
68 void setNeedsRedraw(); | 69 void setNeedsRedraw(); |
69 | 70 |
70 void setMainThreadNeedsLayerTextures(); | 71 void setMainThreadNeedsLayerTextures(); |
71 | 72 |
72 // Like setNeedsRedraw(), but ensures the draw will definitely happen even i
f we are not visible. | 73 // Like setNeedsRedraw(), but ensures the draw will definitely happen even i
f we are not visible. |
73 void setNeedsForcedRedraw(); | 74 void setNeedsForcedRedraw(); |
74 | 75 |
75 void beginFrameComplete(bool hasResourceUpdates); | 76 void beginFrameComplete(); |
76 void beginFrameAborted(); | 77 void beginFrameAborted(); |
77 | 78 |
78 void setMaxFramesPending(int); | 79 void setMaxFramesPending(int); |
79 void didSwapBuffersComplete(); | 80 void didSwapBuffersComplete(); |
80 | 81 |
81 void didLoseContext(); | 82 void didLoseContext(); |
82 void didRecreateContext(); | 83 void didRecreateContext(); |
83 | 84 |
84 bool commitPending() const { return m_stateMachine.commitPending(); } | 85 bool commitPending() const { return m_stateMachine.commitPending(); } |
85 bool redrawPending() const { return m_stateMachine.redrawPending(); } | 86 bool redrawPending() const { return m_stateMachine.redrawPending(); } |
86 | 87 |
87 void setTimebaseAndInterval(double timebase, double intervalSeconds); | 88 void setTimebaseAndInterval(double timebase, double intervalSeconds); |
88 | 89 |
89 // CCFrameRateControllerClient implementation | 90 // CCFrameRateControllerClient implementation |
90 virtual void vsyncTick() OVERRIDE; | 91 virtual void vsyncTick() OVERRIDE; |
91 | 92 |
92 void updateResourcesComplete(); | |
93 | |
94 private: | 93 private: |
95 CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>); | 94 CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>); |
96 | 95 |
97 CCSchedulerStateMachine::Action nextAction(); | 96 CCSchedulerStateMachine::Action nextAction(); |
98 void processScheduledActions(); | 97 void processScheduledActions(); |
99 | 98 |
100 CCSchedulerClient* m_client; | 99 CCSchedulerClient* m_client; |
101 OwnPtr<CCFrameRateController> m_frameRateController; | 100 OwnPtr<CCFrameRateController> m_frameRateController; |
102 CCSchedulerStateMachine m_stateMachine; | 101 CCSchedulerStateMachine m_stateMachine; |
103 bool m_hasMoreResourceUpdates; | |
104 bool m_updateMoreResourcesPending; | 102 bool m_updateMoreResourcesPending; |
105 }; | 103 }; |
106 | 104 |
107 } | 105 } |
108 | 106 |
109 #endif // CCScheduler_h | 107 #endif // CCScheduler_h |
OLD | NEW |