| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 ~Scheduler() override; | 92 ~Scheduler() override; |
| 93 | 93 |
| 94 // BeginFrameObserverMixin | 94 // BeginFrameObserverMixin |
| 95 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; | 95 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; |
| 96 | 96 |
| 97 void OnDrawForOutputSurface(); | 97 void OnDrawForOutputSurface(); |
| 98 | 98 |
| 99 const SchedulerSettings& settings() const { return settings_; } | 99 const SchedulerSettings& settings() const { return settings_; } |
| 100 | 100 |
| 101 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); |
| 101 void CommitVSyncParameters(base::TimeTicks timebase, | 102 void CommitVSyncParameters(base::TimeTicks timebase, |
| 102 base::TimeDelta interval); | 103 base::TimeDelta interval); |
| 103 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 104 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
| 104 | 105 |
| 105 void SetCanStart(); | 106 void SetCanStart(); |
| 106 | 107 |
| 107 void SetVisible(bool visible); | 108 void SetVisible(bool visible); |
| 108 void SetCanDraw(bool can_draw); | 109 void SetCanDraw(bool can_draw); |
| 109 void NotifyReadyToActivate(); | 110 void NotifyReadyToActivate(); |
| 110 void NotifyReadyToDraw(); | 111 void NotifyReadyToDraw(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 138 bool MainFrameForTestingWillHappen() const { | 139 bool MainFrameForTestingWillHappen() const { |
| 139 return state_machine_.CommitPending() || | 140 return state_machine_.CommitPending() || |
| 140 state_machine_.CouldSendBeginMainFrame(); | 141 state_machine_.CouldSendBeginMainFrame(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 bool CommitPending() const { return state_machine_.CommitPending(); } | 144 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 144 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 145 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| 145 bool PrepareTilesPending() const { | 146 bool PrepareTilesPending() const { |
| 146 return state_machine_.PrepareTilesPending(); | 147 return state_machine_.PrepareTilesPending(); |
| 147 } | 148 } |
| 148 bool MainThreadIsInHighLatencyMode() const { | |
| 149 return state_machine_.MainThreadIsInHighLatencyMode(); | |
| 150 } | |
| 151 bool BeginImplFrameDeadlinePending() const { | 149 bool BeginImplFrameDeadlinePending() const { |
| 152 return !begin_impl_frame_deadline_task_.IsCancelled(); | 150 return !begin_impl_frame_deadline_task_.IsCancelled(); |
| 153 } | 151 } |
| 154 | 152 |
| 155 base::TimeTicks AnticipatedDrawTime() const; | 153 base::TimeTicks AnticipatedDrawTime() const; |
| 156 | 154 |
| 157 void NotifyBeginMainFrameStarted(); | 155 void NotifyBeginMainFrameStarted(); |
| 158 | 156 |
| 159 base::TimeTicks LastBeginImplFrameTime(); | 157 base::TimeTicks LastBeginImplFrameTime(); |
| 160 | 158 |
| 161 void SetDeferCommits(bool defer_commits); | 159 void SetDeferCommits(bool defer_commits); |
| 162 | 160 |
| 163 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 161 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 164 void AsValueInto(base::trace_event::TracedValue* value) const override; | 162 void AsValueInto(base::trace_event::TracedValue* value) const override; |
| 165 | 163 |
| 166 void SetContinuousPainting(bool continuous_painting) { | 164 void SetContinuousPainting(bool continuous_painting) { |
| 167 state_machine_.SetContinuousPainting(continuous_painting); | 165 state_machine_.SetContinuousPainting(continuous_painting); |
| 168 } | 166 } |
| 169 | 167 |
| 170 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); | 168 void SetChildrenNeedBeginFrames(bool children_need_begin_frames); |
| 171 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 169 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
| 172 | 170 |
| 173 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | |
| 174 | |
| 175 protected: | 171 protected: |
| 176 Scheduler(SchedulerClient* client, | 172 Scheduler(SchedulerClient* client, |
| 177 const SchedulerSettings& scheduler_settings, | 173 const SchedulerSettings& scheduler_settings, |
| 178 int layer_tree_host_id, | 174 int layer_tree_host_id, |
| 179 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 175 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 180 scoped_ptr<BeginFrameSource> external_begin_frame_source, | 176 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 181 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 177 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
| 182 | 178 |
| 183 // virtual for testing - Don't call these in the constructor or | 179 // virtual for testing - Don't call these in the constructor or |
| 184 // destructor! | 180 // destructor! |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 SchedulerStateMachine::Action inside_action_; | 218 SchedulerStateMachine::Action inside_action_; |
| 223 | 219 |
| 224 private: | 220 private: |
| 225 void ScheduleBeginImplFrameDeadline(); | 221 void ScheduleBeginImplFrameDeadline(); |
| 226 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 222 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 227 void SetupNextBeginFrameIfNeeded(); | 223 void SetupNextBeginFrameIfNeeded(); |
| 228 void PostBeginRetroFrameIfNeeded(); | 224 void PostBeginRetroFrameIfNeeded(); |
| 229 void SetupPollingMechanisms(); | 225 void SetupPollingMechanisms(); |
| 230 void DrawAndSwapIfPossible(); | 226 void DrawAndSwapIfPossible(); |
| 231 void ProcessScheduledActions(); | 227 void ProcessScheduledActions(); |
| 228 bool ShouldRecoverMainLatency() const; |
| 229 bool ShouldRecoverImplLatency() const; |
| 232 bool CanCommitAndActivateBeforeDeadline() const; | 230 bool CanCommitAndActivateBeforeDeadline() const; |
| 233 void AdvanceCommitStateIfPossible(); | 231 void AdvanceCommitStateIfPossible(); |
| 234 bool IsBeginMainFrameSentOrStarted() const; | 232 bool IsBeginMainFrameSentOrStarted() const; |
| 235 void BeginRetroFrame(); | 233 void BeginRetroFrame(); |
| 236 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 234 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
| 237 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 235 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
| 238 void BeginImplFrame(); | 236 void BeginImplFrame(); |
| 239 void FinishImplFrame(); | 237 void FinishImplFrame(); |
| 240 void OnBeginImplFrameDeadline(); | 238 void OnBeginImplFrameDeadline(); |
| 241 void PollToAdvanceCommitState(); | 239 void PollToAdvanceCommitState(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 252 | 250 |
| 253 friend class SchedulerFrameSourcesConstructor; | 251 friend class SchedulerFrameSourcesConstructor; |
| 254 friend class TestSchedulerFrameSourcesConstructor; | 252 friend class TestSchedulerFrameSourcesConstructor; |
| 255 | 253 |
| 256 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 254 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 257 }; | 255 }; |
| 258 | 256 |
| 259 } // namespace cc | 257 } // namespace cc |
| 260 | 258 |
| 261 #endif // CC_SCHEDULER_SCHEDULER_H_ | 259 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |