| 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" |  | 
| 13 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" | 
| 14 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" | 
| 15 #include "cc/scheduler/commit_earlyout_reason.h" | 14 #include "cc/scheduler/commit_earlyout_reason.h" | 
| 16 #include "cc/scheduler/draw_result.h" | 15 #include "cc/scheduler/draw_result.h" | 
| 17 #include "cc/scheduler/scheduler_settings.h" | 16 #include "cc/scheduler/scheduler_settings.h" | 
| 18 | 17 | 
| 19 namespace base { | 18 namespace base { | 
| 20 namespace trace_event { | 19 namespace trace_event { | 
| 21 class ConvertableToTraceFormat; | 20 class ConvertableToTraceFormat; | 
| 22 class TracedValue; | 21 class TracedValue; | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108     ACTION_ACTIVATE_SYNC_TREE, | 107     ACTION_ACTIVATE_SYNC_TREE, | 
| 109     ACTION_DRAW_AND_SWAP_IF_POSSIBLE, | 108     ACTION_DRAW_AND_SWAP_IF_POSSIBLE, | 
| 110     ACTION_DRAW_AND_SWAP_FORCED, | 109     ACTION_DRAW_AND_SWAP_FORCED, | 
| 111     ACTION_DRAW_AND_SWAP_ABORT, | 110     ACTION_DRAW_AND_SWAP_ABORT, | 
| 112     ACTION_BEGIN_OUTPUT_SURFACE_CREATION, | 111     ACTION_BEGIN_OUTPUT_SURFACE_CREATION, | 
| 113     ACTION_PREPARE_TILES, | 112     ACTION_PREPARE_TILES, | 
| 114   }; | 113   }; | 
| 115   static const char* ActionToString(Action action); | 114   static const char* ActionToString(Action action); | 
| 116 | 115 | 
| 117   scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 116   scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 
| 118   void AsValueInto(base::trace_event::TracedValue* dict, | 117   void AsValueInto(base::trace_event::TracedValue* dict) const; | 
| 119                    base::TimeTicks now) const; |  | 
| 120 | 118 | 
| 121   Action NextAction() const; | 119   Action NextAction() const; | 
| 122   void UpdateState(Action action); | 120   void UpdateState(Action action); | 
| 123 | 121 | 
| 124   // Indicates whether the impl thread needs a BeginImplFrame callback in order | 122   // Indicates whether the impl thread needs a BeginImplFrame callback in order | 
| 125   // to make progress. | 123   // to make progress. | 
| 126   bool BeginFrameNeeded() const; | 124   bool BeginFrameNeeded() const; | 
| 127 | 125 | 
| 128   // Indicates whether the scheduler should call | 126   // Indicates whether the scheduler should call | 
| 129   // SetNeedsBeginFrames(BeginFrameNeeded()) on the frame source. | 127   // SetNeedsBeginFrames(BeginFrameNeeded()) on the frame source. | 
| 130   bool ShouldSetNeedsBeginFrames(bool frame_source_needs_begin_frames) const; | 128   bool ShouldSetNeedsBeginFrames(bool frame_source_needs_begin_frames) const; | 
| 131 | 129 | 
| 132   // Indicates that we need to independently poll for new state and actions | 130   // Indicates that we need to independently poll for new state and actions | 
| 133   // because we can't expect a BeginImplFrame. This is mostly used to avoid | 131   // because we can't expect a BeginImplFrame. This is mostly used to avoid | 
| 134   // drawing repeat frames with the synchronous compositor without dropping | 132   // drawing repeat frames with the synchronous compositor without dropping | 
| 135   // necessary actions on the floor. | 133   // necessary actions on the floor. | 
| 136   bool ShouldPollForAnticipatedDrawTriggers() const; | 134   bool ShouldPollForAnticipatedDrawTriggers() const; | 
| 137 | 135 | 
| 138   // Indicates that the system has entered and left a BeginImplFrame callback. | 136   // Indicates that the system has entered and left a BeginImplFrame callback. | 
| 139   // The scheduler will not draw more than once in a given BeginImplFrame | 137   // The scheduler will not draw more than once in a given BeginImplFrame | 
| 140   // callback nor send more than one BeginMainFrame message. | 138   // callback nor send more than one BeginMainFrame message. | 
| 141   void OnBeginImplFrame(const BeginFrameArgs& args); | 139   void OnBeginImplFrame(); | 
| 142   void OnBeginImplFrameDeadlinePending(); | 140   void OnBeginImplFrameDeadlinePending(); | 
| 143   void OnBeginImplFrameDeadline(); | 141   void OnBeginImplFrameDeadline(); | 
| 144   void OnBeginImplFrameIdle(); | 142   void OnBeginImplFrameIdle(); | 
| 145   BeginImplFrameState begin_impl_frame_state() const { | 143   BeginImplFrameState begin_impl_frame_state() const { | 
| 146     return begin_impl_frame_state_; | 144     return begin_impl_frame_state_; | 
| 147   } | 145   } | 
| 148   BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 146   BeginImplFrameDeadlineMode CurrentBeginImplFrameDeadlineMode() const; | 
| 149 | 147 | 
| 150   // If the main thread didn't manage to produce a new frame in time for the | 148   // If the main thread didn't manage to produce a new frame in time for the | 
| 151   // impl thread to draw, it is in a high latency mode. | 149   // impl thread to draw, it is in a high latency mode. | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 294   void UpdateStateOnDraw(bool did_request_swap); | 292   void UpdateStateOnDraw(bool did_request_swap); | 
| 295   void UpdateStateOnPrepareTiles(); | 293   void UpdateStateOnPrepareTiles(); | 
| 296 | 294 | 
| 297   const SchedulerSettings settings_; | 295   const SchedulerSettings settings_; | 
| 298 | 296 | 
| 299   OutputSurfaceState output_surface_state_; | 297   OutputSurfaceState output_surface_state_; | 
| 300   BeginImplFrameState begin_impl_frame_state_; | 298   BeginImplFrameState begin_impl_frame_state_; | 
| 301   CommitState commit_state_; | 299   CommitState commit_state_; | 
| 302   ForcedRedrawOnTimeoutState forced_redraw_state_; | 300   ForcedRedrawOnTimeoutState forced_redraw_state_; | 
| 303 | 301 | 
| 304   BeginFrameArgs begin_impl_frame_args_; |  | 
| 305 |  | 
| 306   int commit_count_; | 302   int commit_count_; | 
| 307   int current_frame_number_; | 303   int current_frame_number_; | 
| 308   int last_frame_number_animate_performed_; | 304   int last_frame_number_animate_performed_; | 
| 309   int last_frame_number_swap_performed_; | 305   int last_frame_number_swap_performed_; | 
| 310   int last_frame_number_swap_requested_; | 306   int last_frame_number_swap_requested_; | 
| 311   int last_frame_number_begin_main_frame_sent_; | 307   int last_frame_number_begin_main_frame_sent_; | 
| 312 | 308 | 
| 313   // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 309   // prepare_tiles_funnel_ is "filled" each time PrepareTiles is called | 
| 314   // and "drained" on each BeginImplFrame. If the funnel gets too full, | 310   // and "drained" on each BeginImplFrame. If the funnel gets too full, | 
| 315   // we start throttling ACTION_PREPARE_TILES such that we average one | 311   // we start throttling ACTION_PREPARE_TILES such that we average one | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 338   bool children_need_begin_frames_; | 334   bool children_need_begin_frames_; | 
| 339   bool defer_commits_; | 335   bool defer_commits_; | 
| 340 | 336 | 
| 341  private: | 337  private: | 
| 342   DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 338   DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 
| 343 }; | 339 }; | 
| 344 | 340 | 
| 345 }  // namespace cc | 341 }  // namespace cc | 
| 346 | 342 | 
| 347 #endif  // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 343 #endif  // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 
| OLD | NEW | 
|---|