| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 16 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
| 17 #include "cc/scheduler/begin_frame_source.h" | 17 #include "cc/scheduler/begin_frame_source.h" |
| 18 #include "cc/scheduler/begin_frame_tracker.h" | 18 #include "cc/scheduler/begin_frame_tracker.h" |
| 19 #include "cc/scheduler/delay_based_time_source.h" | 19 #include "cc/scheduler/delay_based_time_source.h" |
| 20 #include "cc/scheduler/draw_result.h" | 20 #include "cc/scheduler/draw_result.h" |
| 21 #include "cc/scheduler/scheduler_settings.h" | 21 #include "cc/scheduler/scheduler_settings.h" |
| 22 #include "cc/scheduler/scheduler_state_machine.h" | 22 #include "cc/scheduler/scheduler_state_machine.h" |
| 23 #include "cc/tiles/tile_priority.h" |
| 23 | 24 |
| 24 namespace base { | 25 namespace base { |
| 25 namespace trace_event { | 26 namespace trace_event { |
| 26 class ConvertableToTraceFormat; | 27 class ConvertableToTraceFormat; |
| 27 } | 28 } |
| 28 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace cc { | 32 namespace cc { |
| 32 | 33 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 92 |
| 92 void SetNeedsRedraw(); | 93 void SetNeedsRedraw(); |
| 93 | 94 |
| 94 void SetNeedsAnimate(); | 95 void SetNeedsAnimate(); |
| 95 | 96 |
| 96 void SetNeedsPrepareTiles(); | 97 void SetNeedsPrepareTiles(); |
| 97 | 98 |
| 98 void DidSwapBuffers(); | 99 void DidSwapBuffers(); |
| 99 void DidSwapBuffersComplete(); | 100 void DidSwapBuffersComplete(); |
| 100 | 101 |
| 101 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 102 void SetTreePrioritiesAndScrollState(TreePriority tree_priority, |
| 103 ScrollHandlerState scroll_handler_state); |
| 102 | 104 |
| 103 void NotifyReadyToCommit(); | 105 void NotifyReadyToCommit(); |
| 104 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 106 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
| 105 void DidCommit(); | 107 void DidCommit(); |
| 106 | 108 |
| 107 void WillPrepareTiles(); | 109 void WillPrepareTiles(); |
| 108 void DidPrepareTiles(); | 110 void DidPrepareTiles(); |
| 109 void DidLoseOutputSurface(); | 111 void DidLoseOutputSurface(); |
| 110 void DidCreateAndInitializeOutputSurface(); | 112 void DidCreateAndInitializeOutputSurface(); |
| 111 | 113 |
| 112 // Tests do not want to shut down until all possible BeginMainFrames have | 114 // Tests do not want to shut down until all possible BeginMainFrames have |
| 113 // occured to prevent flakiness. | 115 // occured to prevent flakiness. |
| 114 bool MainFrameForTestingWillHappen() const { | 116 bool MainFrameForTestingWillHappen() const { |
| 115 return state_machine_.CommitPending() || | 117 return state_machine_.CommitPending() || |
| 116 state_machine_.CouldSendBeginMainFrame(); | 118 state_machine_.CouldSendBeginMainFrame(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 bool CommitPending() const { return state_machine_.CommitPending(); } | 121 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 120 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 122 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| 121 bool PrepareTilesPending() const { | 123 bool PrepareTilesPending() const { |
| 122 return state_machine_.PrepareTilesPending(); | 124 return state_machine_.PrepareTilesPending(); |
| 123 } | 125 } |
| 124 bool BeginImplFrameDeadlinePending() const { | 126 bool BeginImplFrameDeadlinePending() const { |
| 125 return !begin_impl_frame_deadline_task_.IsCancelled(); | 127 return !begin_impl_frame_deadline_task_.IsCancelled(); |
| 126 } | 128 } |
| 127 bool ImplLatencyTakesPriority() const { | 129 bool ImplLatencyTakesPriority() const { |
| 128 return state_machine_.impl_latency_takes_priority(); | 130 return state_machine_.ImplLatencyTakesPriority(); |
| 129 } | 131 } |
| 130 | 132 |
| 131 // Pass in a main_thread_start_time of base::TimeTicks() if it is not | 133 // Pass in a main_thread_start_time of base::TimeTicks() if it is not |
| 132 // known or not trustworthy (e.g. blink is running on a remote channel) | 134 // known or not trustworthy (e.g. blink is running on a remote channel) |
| 133 // to signal that the start time isn't known and should not be used for | 135 // to signal that the start time isn't known and should not be used for |
| 134 // scheduling or statistics purposes. | 136 // scheduling or statistics purposes. |
| 135 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); | 137 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); |
| 136 | 138 |
| 137 base::TimeTicks LastBeginImplFrameTime(); | 139 base::TimeTicks LastBeginImplFrameTime(); |
| 138 | 140 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 195 |
| 194 private: | 196 private: |
| 195 void ScheduleBeginImplFrameDeadline(); | 197 void ScheduleBeginImplFrameDeadline(); |
| 196 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 198 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
| 197 void SetupNextBeginFrameIfNeeded(); | 199 void SetupNextBeginFrameIfNeeded(); |
| 198 void PostBeginRetroFrameIfNeeded(); | 200 void PostBeginRetroFrameIfNeeded(); |
| 199 void DrawAndSwapIfPossible(); | 201 void DrawAndSwapIfPossible(); |
| 200 void DrawAndSwapForced(); | 202 void DrawAndSwapForced(); |
| 201 void ProcessScheduledActions(); | 203 void ProcessScheduledActions(); |
| 202 void UpdateCompositorTimingHistoryRecordingEnabled(); | 204 void UpdateCompositorTimingHistoryRecordingEnabled(); |
| 203 bool ShouldRecoverMainLatency(const BeginFrameArgs& args) const; | 205 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, |
| 204 bool ShouldRecoverImplLatency(const BeginFrameArgs& args) const; | 206 bool can_activate_before_deadline) const; |
| 205 bool CanCommitAndActivateBeforeDeadline(const BeginFrameArgs& args) const; | 207 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, |
| 208 bool can_activate_before_deadline) const; |
| 209 bool CanBeginMainFrameAndActivateBeforeDeadline( |
| 210 const BeginFrameArgs& args, |
| 211 base::TimeDelta bmf_to_activate_estimate) const; |
| 206 void AdvanceCommitStateIfPossible(); | 212 void AdvanceCommitStateIfPossible(); |
| 207 bool IsBeginMainFrameSentOrStarted() const; | 213 bool IsBeginMainFrameSentOrStarted() const; |
| 208 void BeginRetroFrame(); | 214 void BeginRetroFrame(); |
| 209 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 215 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
| 210 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 216 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
| 211 void BeginImplFrame(const BeginFrameArgs& args); | 217 void BeginImplFrame(const BeginFrameArgs& args); |
| 212 void FinishImplFrame(); | 218 void FinishImplFrame(); |
| 213 void OnBeginImplFrameDeadline(); | 219 void OnBeginImplFrameDeadline(); |
| 214 void PollToAdvanceCommitState(); | 220 void PollToAdvanceCommitState(); |
| 215 | 221 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 230 } | 236 } |
| 231 | 237 |
| 232 base::WeakPtrFactory<Scheduler> weak_factory_; | 238 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 233 | 239 |
| 234 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 240 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 235 }; | 241 }; |
| 236 | 242 |
| 237 } // namespace cc | 243 } // namespace cc |
| 238 | 244 |
| 239 #endif // CC_SCHEDULER_SCHEDULER_H_ | 245 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |