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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "cc/output/begin_frame_args.h" | 14 #include "cc/output/begin_frame_args.h" |
15 #include "cc/scheduler/draw_swap_readback_result.h" | 15 #include "cc/scheduler/draw_result.h" |
16 #include "cc/scheduler/scheduler_settings.h" | 16 #include "cc/scheduler/scheduler_settings.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Value; | 19 class Value; |
20 } | 20 } |
21 | 21 |
22 namespace cc { | 22 namespace cc { |
23 | 23 |
24 // The SchedulerStateMachine decides how to coordinate main thread activites | 24 // The SchedulerStateMachine decides how to coordinate main thread activites |
25 // like painting/running javascript with rendering and input activities on the | 25 // like painting/running javascript with rendering and input activities on the |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 | 186 |
187 // Notification from the OutputSurface that a swap has been consumed. | 187 // Notification from the OutputSurface that a swap has been consumed. |
188 void DidSwapBuffersComplete(); | 188 void DidSwapBuffersComplete(); |
189 | 189 |
190 // Indicates whether to prioritize animation smoothness over new content | 190 // Indicates whether to prioritize animation smoothness over new content |
191 // activation. | 191 // activation. |
192 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); | 192 void SetSmoothnessTakesPriority(bool smoothness_takes_priority); |
193 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } | 193 bool smoothness_takes_priority() const { return smoothness_takes_priority_; } |
194 | 194 |
195 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. | 195 // Indicates whether ACTION_DRAW_AND_SWAP_IF_POSSIBLE drew to the screen. |
196 void DidDrawIfPossibleCompleted(DrawSwapReadbackResult::DrawResult result); | 196 void DidDrawIfPossibleCompleted(DrawResult result); |
197 | 197 |
198 // Indicates that a new commit flow needs to be performed, either to pull | 198 // Indicates that a new commit flow needs to be performed, either to pull |
199 // updates from the main thread to the impl, or to push deltas from the impl | 199 // updates from the main thread to the impl, or to push deltas from the impl |
200 // thread to main. | 200 // thread to main. |
201 void SetNeedsCommit(); | 201 void SetNeedsCommit(); |
202 | 202 |
203 // As SetNeedsCommit(), but ensures the BeginMainFrame will be sent even | 203 // As SetNeedsCommit(), but ensures the BeginMainFrame will be sent even |
204 // if we are not visible. After this call we expect to go through | 204 // if we are not visible. After this call we expect to go through |
205 // the forced commit flow and then return to waiting for a non-forced | 205 // the forced commit flow and then return to waiting for a non-forced |
206 // BeginMainFrame to finish. | 206 // BeginMainFrame to finish. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 bool ShouldDrawForced() const; | 263 bool ShouldDrawForced() const; |
264 bool ShouldDraw() const; | 264 bool ShouldDraw() const; |
265 bool ShouldActivatePendingTree() const; | 265 bool ShouldActivatePendingTree() const; |
266 bool ShouldUpdateVisibleTiles() const; | 266 bool ShouldUpdateVisibleTiles() const; |
267 bool ShouldSendBeginMainFrame() const; | 267 bool ShouldSendBeginMainFrame() const; |
268 bool ShouldCommit() const; | 268 bool ShouldCommit() const; |
269 bool ShouldManageTiles() const; | 269 bool ShouldManageTiles() const; |
270 | 270 |
271 void AdvanceCurrentFrameNumber(); | 271 void AdvanceCurrentFrameNumber(); |
272 bool HasSentBeginMainFrameThisFrame() const; | 272 bool HasSentBeginMainFrameThisFrame() const; |
273 bool HasSentDrawRequestThisFrame() const; | |
274 bool HasScheduledManageTilesThisFrame() const; | |
brianderson
2014/05/08 02:24:13
Is this used anywhere?
simonhong
2014/05/08 03:13:31
Oops! added accidently.
Removed.
| |
273 bool HasUpdatedVisibleTilesThisFrame() const; | 275 bool HasUpdatedVisibleTilesThisFrame() const; |
274 bool HasSwappedThisFrame() const; | 276 bool HasSwappedThisFrame() const; |
277 bool HasSentSwapRequestThisFrame() const; | |
275 | 278 |
276 void UpdateStateOnCommit(bool commit_was_aborted); | 279 void UpdateStateOnCommit(bool commit_was_aborted); |
277 void UpdateStateOnActivation(); | 280 void UpdateStateOnActivation(); |
278 void UpdateStateOnDraw(bool did_request_swap); | 281 void UpdateStateOnDraw(bool did_request_swap); |
279 void UpdateStateOnManageTiles(); | 282 void UpdateStateOnManageTiles(); |
280 | 283 |
281 const SchedulerSettings settings_; | 284 const SchedulerSettings settings_; |
282 | 285 |
283 OutputSurfaceState output_surface_state_; | 286 OutputSurfaceState output_surface_state_; |
284 BeginImplFrameState begin_impl_frame_state_; | 287 BeginImplFrameState begin_impl_frame_state_; |
285 CommitState commit_state_; | 288 CommitState commit_state_; |
286 ForcedRedrawOnTimeoutState forced_redraw_state_; | 289 ForcedRedrawOnTimeoutState forced_redraw_state_; |
287 SynchronousReadbackState readback_state_; | 290 SynchronousReadbackState readback_state_; |
288 | 291 |
289 BeginFrameArgs begin_impl_frame_args_; | 292 BeginFrameArgs begin_impl_frame_args_; |
290 | 293 |
291 int commit_count_; | 294 int commit_count_; |
292 int current_frame_number_; | 295 int current_frame_number_; |
293 int last_frame_number_animate_performed_; | 296 int last_frame_number_animate_performed_; |
294 int last_frame_number_swap_performed_; | 297 int last_frame_number_swap_performed_; |
298 int last_frame_number_swap_request_sent_; | |
295 int last_frame_number_begin_main_frame_sent_; | 299 int last_frame_number_begin_main_frame_sent_; |
300 int last_frame_number_draw_request_sent_; | |
296 int last_frame_number_update_visible_tiles_was_called_; | 301 int last_frame_number_update_visible_tiles_was_called_; |
297 | 302 |
298 // manage_tiles_funnel_ is "filled" each time ManageTiles is called | 303 // manage_tiles_funnel_ is "filled" each time ManageTiles is called |
299 // and "drained" on each BeginImplFrame. If the funnel gets too full, | 304 // and "drained" on each BeginImplFrame. If the funnel gets too full, |
300 // we start throttling ACTION_MANAGE_TILES such that we average one | 305 // we start throttling ACTION_MANAGE_TILES such that we average one |
301 // ManageTile per BeginImplFrame. | 306 // ManageTile per BeginImplFrame. |
302 int manage_tiles_funnel_; | 307 int manage_tiles_funnel_; |
303 int consecutive_checkerboard_animations_; | 308 int consecutive_checkerboard_animations_; |
304 int max_pending_swaps_; | 309 int max_pending_swaps_; |
305 int pending_swaps_; | 310 int pending_swaps_; |
(...skipping 16 matching lines...) Expand all Loading... | |
322 bool continuous_painting_; | 327 bool continuous_painting_; |
323 bool needs_back_to_back_readback_; | 328 bool needs_back_to_back_readback_; |
324 | 329 |
325 private: | 330 private: |
326 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 331 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
327 }; | 332 }; |
328 | 333 |
329 } // namespace cc | 334 } // namespace cc |
330 | 335 |
331 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 336 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |