| 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_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_H_ |
| 6 #define CC_SCHEDULER_SCHEDULER_H_ | 6 #define CC_SCHEDULER_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 public: | 36 public: |
| 37 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 37 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
| 38 virtual void ScheduledActionSendBeginMainFrame() = 0; | 38 virtual void ScheduledActionSendBeginMainFrame() = 0; |
| 39 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; | 39 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; |
| 40 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; | 40 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; |
| 41 virtual void ScheduledActionAnimate() = 0; | 41 virtual void ScheduledActionAnimate() = 0; |
| 42 virtual void ScheduledActionCommit() = 0; | 42 virtual void ScheduledActionCommit() = 0; |
| 43 virtual void ScheduledActionActivateSyncTree() = 0; | 43 virtual void ScheduledActionActivateSyncTree() = 0; |
| 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 45 virtual void ScheduledActionPrepareTiles() = 0; | 45 virtual void ScheduledActionPrepareTiles() = 0; |
| 46 virtual void ScheduledActionInvalidateOutputSurface() = 0; |
| 46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 47 virtual base::TimeDelta DrawDurationEstimate() = 0; | 48 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 48 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 49 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
| 49 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 50 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 50 virtual void DidBeginImplFrameDeadline() = 0; | 51 virtual void DidBeginImplFrameDeadline() = 0; |
| 51 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0; | 52 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0; |
| 52 | 53 |
| 53 protected: | 54 protected: |
| 54 virtual ~SchedulerClient() {} | 55 virtual ~SchedulerClient() {} |
| 55 }; | 56 }; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 111 |
| 111 void SetVisible(bool visible); | 112 void SetVisible(bool visible); |
| 112 void SetCanDraw(bool can_draw); | 113 void SetCanDraw(bool can_draw); |
| 113 void NotifyReadyToActivate(); | 114 void NotifyReadyToActivate(); |
| 114 void NotifyReadyToDraw(); | 115 void NotifyReadyToDraw(); |
| 115 | 116 |
| 116 void SetNeedsCommit(); | 117 void SetNeedsCommit(); |
| 117 | 118 |
| 118 void SetNeedsRedraw(); | 119 void SetNeedsRedraw(); |
| 119 | 120 |
| 121 void OutputSurfaceDidRequestDraw(); |
| 122 |
| 120 void SetNeedsAnimate(); | 123 void SetNeedsAnimate(); |
| 121 | 124 |
| 122 void SetNeedsPrepareTiles(); | 125 void SetNeedsPrepareTiles(); |
| 123 | 126 |
| 124 void SetMaxSwapsPending(int max); | 127 void SetMaxSwapsPending(int max); |
| 125 void DidSwapBuffers(); | 128 void DidSwapBuffers(); |
| 126 void DidSwapBuffersComplete(); | 129 void DidSwapBuffersComplete(); |
| 127 | 130 |
| 128 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 131 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); |
| 129 | 132 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 bool begin_retro_frame_posted_; | 208 bool begin_retro_frame_posted_; |
| 206 std::deque<BeginFrameArgs> begin_retro_frame_args_; | 209 std::deque<BeginFrameArgs> begin_retro_frame_args_; |
| 207 BeginFrameArgs begin_impl_frame_args_; | 210 BeginFrameArgs begin_impl_frame_args_; |
| 208 SchedulerStateMachine::BeginImplFrameDeadlineMode | 211 SchedulerStateMachine::BeginImplFrameDeadlineMode |
| 209 begin_impl_frame_deadline_mode_; | 212 begin_impl_frame_deadline_mode_; |
| 210 | 213 |
| 211 base::Closure begin_retro_frame_closure_; | 214 base::Closure begin_retro_frame_closure_; |
| 212 base::Closure begin_unthrottled_frame_closure_; | 215 base::Closure begin_unthrottled_frame_closure_; |
| 213 | 216 |
| 214 base::Closure begin_impl_frame_deadline_closure_; | 217 base::Closure begin_impl_frame_deadline_closure_; |
| 215 base::Closure poll_for_draw_triggers_closure_; | |
| 216 base::Closure advance_commit_state_closure_; | 218 base::Closure advance_commit_state_closure_; |
| 217 base::CancelableClosure begin_impl_frame_deadline_task_; | 219 base::CancelableClosure begin_impl_frame_deadline_task_; |
| 218 base::CancelableClosure poll_for_draw_triggers_task_; | |
| 219 base::CancelableClosure advance_commit_state_task_; | 220 base::CancelableClosure advance_commit_state_task_; |
| 220 | 221 |
| 221 SchedulerStateMachine state_machine_; | 222 SchedulerStateMachine state_machine_; |
| 222 bool inside_process_scheduled_actions_; | 223 bool inside_process_scheduled_actions_; |
| 223 SchedulerStateMachine::Action inside_action_; | 224 SchedulerStateMachine::Action inside_action_; |
| 224 | 225 |
| 225 private: | 226 private: |
| 226 void ScheduleBeginImplFrameDeadline(); | 227 void ScheduleBeginImplFrameDeadline(); |
| 227 void RescheduleBeginImplFrameDeadlineIfNeeded(); | 228 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 228 void SetupNextBeginFrameIfNeeded(); | 229 void SetupNextBeginFrameIfNeeded(); |
| 229 void PostBeginRetroFrameIfNeeded(); | 230 void PostBeginRetroFrameIfNeeded(); |
| 230 void SetupPollingMechanisms(bool needs_begin_frame); | 231 void SetupPollingMechanisms(bool needs_begin_frame); |
| 231 void DrawAndSwapIfPossible(); | 232 void DrawAndSwapIfPossible(); |
| 232 void ProcessScheduledActions(); | 233 void ProcessScheduledActions(); |
| 233 bool CanCommitAndActivateBeforeDeadline() const; | 234 bool CanCommitAndActivateBeforeDeadline() const; |
| 234 void AdvanceCommitStateIfPossible(); | 235 void AdvanceCommitStateIfPossible(); |
| 235 bool IsBeginMainFrameSentOrStarted() const; | 236 bool IsBeginMainFrameSentOrStarted() const; |
| 236 void BeginRetroFrame(); | 237 void BeginRetroFrame(); |
| 237 void BeginImplFrame(const BeginFrameArgs& args); | 238 void BeginImplFrame(const BeginFrameArgs& args); |
| 238 void OnBeginImplFrameDeadline(); | 239 void OnBeginImplFrameDeadline(); |
| 239 void PollForAnticipatedDrawTriggers(); | |
| 240 void PollToAdvanceCommitState(); | 240 void PollToAdvanceCommitState(); |
| 241 void SetupPowerMonitoring(); | 241 void SetupPowerMonitoring(); |
| 242 void TeardownPowerMonitoring(); | 242 void TeardownPowerMonitoring(); |
| 243 | 243 |
| 244 base::TimeDelta EstimatedParentDrawTime() { | 244 base::TimeDelta EstimatedParentDrawTime() { |
| 245 return estimated_parent_draw_time_; | 245 return estimated_parent_draw_time_; |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool IsInsideAction(SchedulerStateMachine::Action action) { | 248 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 249 return inside_action_ == action; | 249 return inside_action_ == action; |
| 250 } | 250 } |
| 251 | 251 |
| 252 base::WeakPtrFactory<Scheduler> weak_factory_; | 252 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 253 | 253 |
| 254 friend class SchedulerFrameSourcesConstructor; | 254 friend class SchedulerFrameSourcesConstructor; |
| 255 friend class TestSchedulerFrameSourcesConstructor; | 255 friend class TestSchedulerFrameSourcesConstructor; |
| 256 | 256 |
| 257 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 257 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 } // namespace cc | 260 } // namespace cc |
| 261 | 261 |
| 262 #endif // CC_SCHEDULER_SCHEDULER_H_ | 262 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |