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 CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 117 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
118 void AsValueInto(base::debug::TracedValue* dict, base::TimeTicks now) const; | 118 void AsValueInto(base::debug::TracedValue* dict, base::TimeTicks now) const; |
119 | 119 |
120 Action NextAction() const; | 120 Action NextAction() const; |
121 void UpdateState(Action action); | 121 void UpdateState(Action action); |
122 | 122 |
123 // Indicates whether the impl thread needs a BeginImplFrame callback in order | 123 // Indicates whether the impl thread needs a BeginImplFrame callback in order |
124 // to make progress. | 124 // to make progress. |
125 bool BeginFrameNeeded() const; | 125 bool BeginFrameNeeded() const; |
126 | 126 |
| 127 // Indicates whether the scheduler should call |
| 128 // SetNeedsBeginFrames(BeginFrameNeeded()) on the frame source. |
| 129 bool ShouldSetNeedsBeginFrames(bool frame_source_needs_begin_frames) const; |
| 130 |
127 // Indicates that we need to independently poll for new state and actions | 131 // Indicates that we need to independently poll for new state and actions |
128 // because we can't expect a BeginImplFrame. This is mostly used to avoid | 132 // because we can't expect a BeginImplFrame. This is mostly used to avoid |
129 // drawing repeat frames with the synchronous compositor without dropping | 133 // drawing repeat frames with the synchronous compositor without dropping |
130 // necessary actions on the floor. | 134 // necessary actions on the floor. |
131 bool ShouldPollForAnticipatedDrawTriggers() const; | 135 bool ShouldPollForAnticipatedDrawTriggers() const; |
132 | 136 |
133 // Indicates that the system has entered and left a BeginImplFrame callback. | 137 // Indicates that the system has entered and left a BeginImplFrame callback. |
134 // The scheduler will not draw more than once in a given BeginImplFrame | 138 // The scheduler will not draw more than once in a given BeginImplFrame |
135 // callback nor send more than one BeginMainFrame message. | 139 // callback nor send more than one BeginMainFrame message. |
136 void OnBeginImplFrame(const BeginFrameArgs& args); | 140 void OnBeginImplFrame(const BeginFrameArgs& args); |
(...skipping 13 matching lines...) Expand all Loading... |
150 // avoid requesting BeginImplFrames when we won't actually draw but still | 154 // avoid requesting BeginImplFrames when we won't actually draw but still |
151 // need to advance our state at vsync intervals. | 155 // need to advance our state at vsync intervals. |
152 void DidEnterPollForAnticipatedDrawTriggers(); | 156 void DidEnterPollForAnticipatedDrawTriggers(); |
153 void DidLeavePollForAnticipatedDrawTriggers(); | 157 void DidLeavePollForAnticipatedDrawTriggers(); |
154 bool inside_poll_for_anticipated_draw_triggers() const { | 158 bool inside_poll_for_anticipated_draw_triggers() const { |
155 return inside_poll_for_anticipated_draw_triggers_; | 159 return inside_poll_for_anticipated_draw_triggers_; |
156 } | 160 } |
157 | 161 |
158 // Indicates whether the LayerTreeHostImpl is visible. | 162 // Indicates whether the LayerTreeHostImpl is visible. |
159 void SetVisible(bool visible); | 163 void SetVisible(bool visible); |
| 164 bool visible() const { return visible_; } |
160 | 165 |
161 // Indicates that a redraw is required, either due to the impl tree changing | 166 // Indicates that a redraw is required, either due to the impl tree changing |
162 // or the screen being damaged and simply needing redisplay. | 167 // or the screen being damaged and simply needing redisplay. |
163 void SetNeedsRedraw(); | 168 void SetNeedsRedraw(); |
164 bool needs_redraw() const { return needs_redraw_; } | 169 bool needs_redraw() const { return needs_redraw_; } |
165 | 170 |
166 void SetNeedsAnimate(); | 171 void SetNeedsAnimate(); |
167 bool needs_animate() const { return needs_animate_; } | 172 bool needs_animate() const { return needs_animate_; } |
168 | 173 |
169 // Indicates that prepare-tiles is required. This guarantees another | 174 // Indicates that prepare-tiles is required. This guarantees another |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 bool impl_latency_takes_priority_on_battery_; | 342 bool impl_latency_takes_priority_on_battery_; |
338 bool children_need_begin_frames_; | 343 bool children_need_begin_frames_; |
339 | 344 |
340 private: | 345 private: |
341 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 346 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
342 }; | 347 }; |
343 | 348 |
344 } // namespace cc | 349 } // namespace cc |
345 | 350 |
346 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 351 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |