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 CCSchedulerStateMachine_h | 5 #ifndef CCSchedulerStateMachine_h |
6 #define CCSchedulerStateMachine_h | 6 #define CCSchedulerStateMachine_h |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <wtf/Noncopyable.h> | 9 #include <wtf/Noncopyable.h> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 bool commitPending() const | 47 bool commitPending() const |
48 { | 48 { |
49 return m_commitState != COMMIT_STATE_IDLE; | 49 return m_commitState != COMMIT_STATE_IDLE; |
50 } | 50 } |
51 | 51 |
52 bool redrawPending() const { return m_needsRedraw; } | 52 bool redrawPending() const { return m_needsRedraw; } |
53 | 53 |
54 enum Action { | 54 enum Action { |
55 ACTION_NONE, | 55 ACTION_NONE, |
56 ACTION_BEGIN_FRAME, | 56 ACTION_BEGIN_FRAME, |
57 ACTION_BEGIN_UPDATE_MORE_RESOURCES, | 57 ACTION_BEGIN_UPDATE_RESOURCES, |
58 ACTION_COMMIT, | 58 ACTION_COMMIT, |
59 ACTION_DRAW_IF_POSSIBLE, | 59 ACTION_DRAW_IF_POSSIBLE, |
60 ACTION_DRAW_FORCED, | 60 ACTION_DRAW_FORCED, |
61 ACTION_BEGIN_CONTEXT_RECREATION, | 61 ACTION_BEGIN_CONTEXT_RECREATION, |
62 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, | 62 ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD, |
63 }; | 63 }; |
64 Action nextAction() const; | 64 Action nextAction() const; |
65 void updateState(Action); | 65 void updateState(Action); |
66 | 66 |
67 // Indicates whether the scheduler needs a vsync callback in order to make | 67 // Indicates whether the scheduler needs a vsync callback in order to make |
(...skipping 24 matching lines...) Expand all Loading... |
92 // thread to main. | 92 // thread to main. |
93 void setNeedsCommit(); | 93 void setNeedsCommit(); |
94 | 94 |
95 // As setNeedsCommit(), but ensures the beginFrame will definitely happen ev
en if | 95 // As setNeedsCommit(), but ensures the beginFrame will definitely happen ev
en if |
96 // we are not visible. | 96 // we are not visible. |
97 void setNeedsForcedCommit(); | 97 void setNeedsForcedCommit(); |
98 | 98 |
99 // Call this only in response to receiving an ACTION_BEGIN_FRAME | 99 // Call this only in response to receiving an ACTION_BEGIN_FRAME |
100 // from nextState. Indicates that all painting is complete and that | 100 // from nextState. Indicates that all painting is complete and that |
101 // updating of compositor resources can begin. | 101 // updating of compositor resources can begin. |
102 void beginFrameComplete(); | 102 void beginFrameComplete(bool hasResourceUpdates); |
103 | 103 |
104 // Call this only in response to receiving an ACTION_BEGIN_FRAME | 104 // Call this only in response to receiving an ACTION_BEGIN_FRAME |
105 // from nextState if the client rejects the beginFrame message. | 105 // from nextState if the client rejects the beginFrame message. |
106 void beginFrameAborted(); | 106 void beginFrameAborted(); |
107 | 107 |
108 // Call this only in response to receiving an ACTION_UPDATE_MORE_RESOURCES | 108 // Call this only in response to receiving an ACTION_BEGIN_UPDATE_RESOURCES |
109 // from nextState. Indicates that the specific update request completed. | 109 // from nextState. Indicates that all resource updates completed. |
110 void beginUpdateMoreResourcesComplete(bool morePending); | 110 void updateResourcesComplete(); |
111 | 111 |
112 // Request exclusive access to the textures that back single buffered | 112 // Request exclusive access to the textures that back single buffered |
113 // layers on behalf of the main thread. Upon acqusition, | 113 // layers on behalf of the main thread. Upon acqusition, |
114 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the | 114 // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the |
115 // textures to the impl thread by committing the layers. | 115 // textures to the impl thread by committing the layers. |
116 void setMainThreadNeedsLayerTextures(); | 116 void setMainThreadNeedsLayerTextures(); |
117 | 117 |
118 // Indicates whether we can successfully begin a frame at this time. | 118 // Indicates whether we can successfully begin a frame at this time. |
119 void setCanBeginFrame(bool can) { m_canBeginFrame = can; } | 119 void setCanBeginFrame(bool can) { m_canBeginFrame = can; } |
120 | 120 |
(...skipping 23 matching lines...) Expand all Loading... |
144 int m_currentFrameNumber; | 144 int m_currentFrameNumber; |
145 int m_lastFrameNumberWhereDrawWasCalled; | 145 int m_lastFrameNumberWhereDrawWasCalled; |
146 int m_consecutiveFailedDraws; | 146 int m_consecutiveFailedDraws; |
147 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; | 147 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; |
148 bool m_needsRedraw; | 148 bool m_needsRedraw; |
149 bool m_needsForcedRedraw; | 149 bool m_needsForcedRedraw; |
150 bool m_needsForcedRedrawAfterNextCommit; | 150 bool m_needsForcedRedrawAfterNextCommit; |
151 bool m_needsCommit; | 151 bool m_needsCommit; |
152 bool m_needsForcedCommit; | 152 bool m_needsForcedCommit; |
153 bool m_mainThreadNeedsLayerTextures; | 153 bool m_mainThreadNeedsLayerTextures; |
154 bool m_updateMoreResourcesPending; | 154 bool m_updateResourcesCompletePending; |
155 bool m_insideVSync; | 155 bool m_insideVSync; |
156 bool m_visible; | 156 bool m_visible; |
157 bool m_canBeginFrame; | 157 bool m_canBeginFrame; |
158 bool m_canDraw; | 158 bool m_canDraw; |
159 bool m_drawIfPossibleFailed; | 159 bool m_drawIfPossibleFailed; |
160 TextureState m_textureState; | 160 TextureState m_textureState; |
161 ContextState m_contextState; | 161 ContextState m_contextState; |
162 }; | 162 }; |
163 | 163 |
164 } | 164 } |
165 | 165 |
166 #endif // CCSchedulerStateMachine_h | 166 #endif // CCSchedulerStateMachine_h |
OLD | NEW |