Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 virtual void ScheduledActionCommit() = 0; | 39 virtual void ScheduledActionCommit() = 0; |
| 40 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 40 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
| 41 virtual void ScheduledActionActivateSyncTree() = 0; | 41 virtual void ScheduledActionActivateSyncTree() = 0; |
| 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 42 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 43 virtual void ScheduledActionManageTiles() = 0; | 43 virtual void ScheduledActionManageTiles() = 0; |
| 44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 44 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 45 virtual base::TimeDelta DrawDurationEstimate() = 0; | 45 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 46 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
| 47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 47 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 48 virtual void DidBeginImplFrameDeadline() = 0; | 48 virtual void DidBeginImplFrameDeadline() = 0; |
| 49 virtual void SendBeginFrame(const BeginFrameArgs& args) = 0; | |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 virtual ~SchedulerClient() {} | 52 virtual ~SchedulerClient() {} |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 class CC_EXPORT Scheduler { | 55 class CC_EXPORT Scheduler { |
| 55 public: | 56 public: |
| 56 static scoped_ptr<Scheduler> Create( | 57 static scoped_ptr<Scheduler> Create( |
| 57 SchedulerClient* client, | 58 SchedulerClient* client, |
| 58 const SchedulerSettings& scheduler_settings, | 59 const SchedulerSettings& scheduler_settings, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 | 137 |
| 137 bool IsInsideAction(SchedulerStateMachine::Action action) { | 138 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 138 return inside_action_ == action; | 139 return inside_action_ == action; |
| 139 } | 140 } |
| 140 | 141 |
| 141 bool IsBeginMainFrameSent() const; | 142 bool IsBeginMainFrameSent() const; |
| 142 void SetContinuousPainting(bool continuous_painting) { | 143 void SetContinuousPainting(bool continuous_painting) { |
| 143 state_machine_.SetContinuousPainting(continuous_painting); | 144 state_machine_.SetContinuousPainting(continuous_painting); |
| 144 } | 145 } |
| 145 | 146 |
| 147 void BeginFrameRequested(); | |
| 148 | |
| 146 protected: | 149 protected: |
| 147 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { | 150 class CC_EXPORT SyntheticBeginFrameSource : public TimeSourceClient { |
| 148 public: | 151 public: |
| 149 SyntheticBeginFrameSource(Scheduler* scheduler, | 152 SyntheticBeginFrameSource(Scheduler* scheduler, |
| 150 base::SingleThreadTaskRunner* task_runner); | 153 base::SingleThreadTaskRunner* task_runner); |
| 151 virtual ~SyntheticBeginFrameSource(); | 154 virtual ~SyntheticBeginFrameSource(); |
| 152 | 155 |
| 153 // Updates the phase and frequency of the timer. | 156 // Updates the phase and frequency of the timer. |
| 154 void CommitVSyncParameters(base::TimeTicks timebase, | 157 void CommitVSyncParameters(base::TimeTicks timebase, |
| 155 base::TimeDelta interval); | 158 base::TimeDelta interval); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 base::Closure poll_for_draw_triggers_closure_; | 204 base::Closure poll_for_draw_triggers_closure_; |
| 202 base::Closure advance_commit_state_closure_; | 205 base::Closure advance_commit_state_closure_; |
| 203 base::CancelableClosure begin_impl_frame_deadline_task_; | 206 base::CancelableClosure begin_impl_frame_deadline_task_; |
| 204 base::CancelableClosure poll_for_draw_triggers_task_; | 207 base::CancelableClosure poll_for_draw_triggers_task_; |
| 205 base::CancelableClosure advance_commit_state_task_; | 208 base::CancelableClosure advance_commit_state_task_; |
| 206 | 209 |
| 207 SchedulerStateMachine state_machine_; | 210 SchedulerStateMachine state_machine_; |
| 208 bool inside_process_scheduled_actions_; | 211 bool inside_process_scheduled_actions_; |
| 209 SchedulerStateMachine::Action inside_action_; | 212 SchedulerStateMachine::Action inside_action_; |
| 210 | 213 |
| 214 bool begin_frame_requested_; | |
|
brianderson
2014/08/21 00:13:59
Store this in the state machine as children_need_b
simonhong
2014/08/26 08:24:47
Done.
| |
| 215 | |
| 211 private: | 216 private: |
| 212 base::TimeTicks AdjustedBeginImplFrameDeadline( | 217 base::TimeTicks AdjustedBeginImplFrameDeadline( |
| 213 const BeginFrameArgs& args, | 218 const BeginFrameArgs& args, |
| 214 base::TimeDelta draw_duration_estimate) const; | 219 base::TimeDelta draw_duration_estimate) const; |
| 215 void ScheduleBeginImplFrameDeadline(base::TimeTicks deadline); | 220 void ScheduleBeginImplFrameDeadline(base::TimeTicks deadline); |
| 216 void SetupNextBeginFrameIfNeeded(); | 221 void SetupNextBeginFrameIfNeeded(); |
| 217 void PostBeginRetroFrameIfNeeded(); | 222 void PostBeginRetroFrameIfNeeded(); |
| 218 void SetupNextBeginFrameWhenVSyncThrottlingEnabled(bool needs_begin_frame); | 223 void SetupNextBeginFrameWhenVSyncThrottlingEnabled(bool needs_begin_frame); |
| 219 void SetupNextBeginFrameWhenVSyncThrottlingDisabled(bool needs_begin_frame); | 224 void SetupNextBeginFrameWhenVSyncThrottlingDisabled(bool needs_begin_frame); |
| 220 void SetupPollingMechanisms(bool needs_begin_frame); | 225 void SetupPollingMechanisms(bool needs_begin_frame); |
| 221 void DrawAndSwapIfPossible(); | 226 void DrawAndSwapIfPossible(); |
| 222 void ProcessScheduledActions(); | 227 void ProcessScheduledActions(); |
| 223 bool CanCommitAndActivateBeforeDeadline() const; | 228 bool CanCommitAndActivateBeforeDeadline() const; |
| 224 void AdvanceCommitStateIfPossible(); | 229 void AdvanceCommitStateIfPossible(); |
| 225 bool IsBeginMainFrameSentOrStarted() const; | 230 bool IsBeginMainFrameSentOrStarted() const; |
| 226 void SetupSyntheticBeginFrames(); | 231 void SetupSyntheticBeginFrames(); |
| 227 | 232 |
| 228 base::WeakPtrFactory<Scheduler> weak_factory_; | 233 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 229 | 234 |
| 230 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 235 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 231 }; | 236 }; |
| 232 | 237 |
| 233 } // namespace cc | 238 } // namespace cc |
| 234 | 239 |
| 235 #endif // CC_SCHEDULER_SCHEDULER_H_ | 240 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |