Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: cc/scheduler_state_machine.h

Issue 11830040: cc: Do not request redraw on commit when impl-side painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_draw3
Patch Set: delete unnecessary forward declaration, add comments Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CC_SCHEDULER_STATE_MACHINE_H_ 5 #ifndef CC_SCHEDULER_STATE_MACHINE_H_
6 #define CC_SCHEDULER_STATE_MACHINE_H_ 6 #define CC_SCHEDULER_STATE_MACHINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "cc/cc_export.h" 11 #include "cc/cc_export.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class SchedulerSettings;
16
15 // The SchedulerStateMachine decides how to coordinate main thread activites 17 // The SchedulerStateMachine decides how to coordinate main thread activites
16 // like painting/running javascript with rendering and input activities on the 18 // like painting/running javascript with rendering and input activities on the
17 // impl thread. 19 // impl thread.
18 // 20 //
19 // The state machine tracks internal state but is also influenced by external st ate. 21 // The state machine tracks internal state but is also influenced by external st ate.
20 // Internal state includes things like whether a frame has been requested, while 22 // Internal state includes things like whether a frame has been requested, while
21 // external state includes things like the current time being near to the vblank time. 23 // external state includes things like the current time being near to the vblank time.
22 // 24 //
23 // The scheduler seperates "what to do next" from the updating of its internal s tate to 25 // The scheduler seperates "what to do next" from the updating of its internal s tate to
24 // make testing cleaner. 26 // make testing cleaner.
25 class CC_EXPORT SchedulerStateMachine { 27 class CC_EXPORT SchedulerStateMachine {
26 public: 28 public:
27 SchedulerStateMachine(); 29 // settings must be valid for the lifetime of this class.
30 SchedulerStateMachine(const SchedulerSettings* const settings);
28 31
29 enum CommitState { 32 enum CommitState {
30 COMMIT_STATE_IDLE, 33 COMMIT_STATE_IDLE,
31 COMMIT_STATE_FRAME_IN_PROGRESS, 34 COMMIT_STATE_FRAME_IN_PROGRESS,
32 COMMIT_STATE_READY_TO_COMMIT, 35 COMMIT_STATE_READY_TO_COMMIT,
33 COMMIT_STATE_WAITING_FOR_FIRST_DRAW, 36 COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
34 COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW, 37 COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW,
35 }; 38 };
36 39
37 enum TextureState { 40 enum TextureState {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 protected: 145 protected:
143 bool shouldDrawForced() const; 146 bool shouldDrawForced() const;
144 bool drawSuspendedUntilCommit() const; 147 bool drawSuspendedUntilCommit() const;
145 bool scheduledToDraw() const; 148 bool scheduledToDraw() const;
146 bool shouldDraw() const; 149 bool shouldDraw() const;
147 bool shouldAttemptTreeActivation() const; 150 bool shouldAttemptTreeActivation() const;
148 bool shouldAcquireLayerTexturesForMainThread() const; 151 bool shouldAcquireLayerTexturesForMainThread() const;
149 bool hasDrawnThisFrame() const; 152 bool hasDrawnThisFrame() const;
150 bool hasAttemptedTreeActivationThisFrame() const; 153 bool hasAttemptedTreeActivationThisFrame() const;
151 154
155 const SchedulerSettings* const m_settings;
156
152 CommitState m_commitState; 157 CommitState m_commitState;
153 158
154 int m_currentFrameNumber; 159 int m_currentFrameNumber;
155 int m_lastFrameNumberWhereDrawWasCalled; 160 int m_lastFrameNumberWhereDrawWasCalled;
156 int m_lastFrameNumberWhereTreeActivationAttempted; 161 int m_lastFrameNumberWhereTreeActivationAttempted;
157 int m_consecutiveFailedDraws; 162 int m_consecutiveFailedDraws;
158 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced; 163 int m_maximumNumberOfFailedDrawsBeforeDrawIsForced;
159 bool m_needsRedraw; 164 bool m_needsRedraw;
160 bool m_needsForcedRedraw; 165 bool m_needsForcedRedraw;
161 bool m_needsForcedRedrawAfterNextCommit; 166 bool m_needsForcedRedrawAfterNextCommit;
162 bool m_needsCommit; 167 bool m_needsCommit;
163 bool m_needsForcedCommit; 168 bool m_needsForcedCommit;
164 bool m_expectImmediateBeginFrame; 169 bool m_expectImmediateBeginFrame;
165 bool m_mainThreadNeedsLayerTextures; 170 bool m_mainThreadNeedsLayerTextures;
166 bool m_insideVSync; 171 bool m_insideVSync;
167 bool m_visible; 172 bool m_visible;
168 bool m_canBeginFrame; 173 bool m_canBeginFrame;
169 bool m_canDraw; 174 bool m_canDraw;
170 bool m_hasPendingTree; 175 bool m_hasPendingTree;
171 bool m_drawIfPossibleFailed; 176 bool m_drawIfPossibleFailed;
172 TextureState m_textureState; 177 TextureState m_textureState;
173 OutputSurfaceState m_outputSurfaceState; 178 OutputSurfaceState m_outputSurfaceState;
174 179
175 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); 180 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine);
176 }; 181 };
177 182
178 } 183 }
179 184
180 #endif // CC_SCHEDULER_STATE_MACHINE_H_ 185 #endif // CC_SCHEDULER_STATE_MACHINE_H_
OLDNEW
« cc/scheduler.h ('K') | « cc/scheduler.cc ('k') | cc/scheduler_state_machine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698