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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SetMaxSwapsPending(int max); | 99 void SetMaxSwapsPending(int max); |
99 void DidSwapBuffers(); | 100 void DidSwapBuffers(); |
100 void DidSwapBuffersComplete(); | 101 void DidSwapBuffersComplete(); |
101 | 102 |
102 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 103 void SetSmoothnessMode(TreePriority tree_priority, |
| 104 ScrollHandlerState scroll_handler_state); |
103 | 105 |
104 void NotifyReadyToCommit(); | 106 void NotifyReadyToCommit(); |
105 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 107 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
106 void DidCommit(); | 108 void DidCommit(); |
107 | 109 |
108 void WillPrepareTiles(); | 110 void WillPrepareTiles(); |
109 void DidPrepareTiles(); | 111 void DidPrepareTiles(); |
110 void DidLoseOutputSurface(); | 112 void DidLoseOutputSurface(); |
111 void DidCreateAndInitializeOutputSurface(); | 113 void DidCreateAndInitializeOutputSurface(); |
112 | 114 |
113 // Tests do not want to shut down until all possible BeginMainFrames have | 115 // Tests do not want to shut down until all possible BeginMainFrames have |
114 // occured to prevent flakiness. | 116 // occured to prevent flakiness. |
115 bool MainFrameForTestingWillHappen() const { | 117 bool MainFrameForTestingWillHappen() const { |
116 return state_machine_.CommitPending() || | 118 return state_machine_.CommitPending() || |
117 state_machine_.CouldSendBeginMainFrame(); | 119 state_machine_.CouldSendBeginMainFrame(); |
118 } | 120 } |
119 | 121 |
120 bool CommitPending() const { return state_machine_.CommitPending(); } | 122 bool CommitPending() const { return state_machine_.CommitPending(); } |
121 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 123 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
122 bool PrepareTilesPending() const { | 124 bool PrepareTilesPending() const { |
123 return state_machine_.PrepareTilesPending(); | 125 return state_machine_.PrepareTilesPending(); |
124 } | 126 } |
125 bool BeginImplFrameDeadlinePending() const { | 127 bool BeginImplFrameDeadlinePending() const { |
126 return !begin_impl_frame_deadline_task_.IsCancelled(); | 128 return !begin_impl_frame_deadline_task_.IsCancelled(); |
127 } | 129 } |
128 bool ImplLatencyTakesPriority() const { | 130 bool ImplLatencyTakesPriority() const { |
129 return state_machine_.impl_latency_takes_priority(); | 131 return state_machine_.ImplLatencyTakesPriority(); |
130 } | 132 } |
131 | 133 |
132 // Pass in a main_thread_start_time of base::TimeTicks() if it is not | 134 // Pass in a main_thread_start_time of base::TimeTicks() if it is not |
133 // known or not trustworthy (e.g. blink is running on a remote channel) | 135 // known or not trustworthy (e.g. blink is running on a remote channel) |
134 // to signal that the start time isn't known and should not be used for | 136 // to signal that the start time isn't known and should not be used for |
135 // scheduling or statistics purposes. | 137 // scheduling or statistics purposes. |
136 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); | 138 void NotifyBeginMainFrameStarted(base::TimeTicks main_thread_start_time); |
137 | 139 |
138 base::TimeTicks LastBeginImplFrameTime(); | 140 base::TimeTicks LastBeginImplFrameTime(); |
139 | 141 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 196 |
195 private: | 197 private: |
196 void ScheduleBeginImplFrameDeadline(); | 198 void ScheduleBeginImplFrameDeadline(); |
197 void ScheduleBeginImplFrameDeadlineIfNeeded(); | 199 void ScheduleBeginImplFrameDeadlineIfNeeded(); |
198 void SetupNextBeginFrameIfNeeded(); | 200 void SetupNextBeginFrameIfNeeded(); |
199 void PostBeginRetroFrameIfNeeded(); | 201 void PostBeginRetroFrameIfNeeded(); |
200 void DrawAndSwapIfPossible(); | 202 void DrawAndSwapIfPossible(); |
201 void DrawAndSwapForced(); | 203 void DrawAndSwapForced(); |
202 void ProcessScheduledActions(); | 204 void ProcessScheduledActions(); |
203 void UpdateCompositorTimingHistoryRecordingEnabled(); | 205 void UpdateCompositorTimingHistoryRecordingEnabled(); |
204 bool ShouldRecoverMainLatency(const BeginFrameArgs& args) const; | 206 bool ShouldRecoverMainLatency(const BeginFrameArgs& args, |
205 bool ShouldRecoverImplLatency(const BeginFrameArgs& args) const; | 207 bool can_activate_before_deadline) const; |
206 bool CanCommitAndActivateBeforeDeadline(const BeginFrameArgs& args) const; | 208 bool ShouldRecoverImplLatency(const BeginFrameArgs& args, |
| 209 bool can_activate_before_deadline) const; |
| 210 bool CanBeginMainFrameAndActivateBeforeDeadline( |
| 211 const BeginFrameArgs& args, |
| 212 base::TimeDelta bmf_to_activate_estimate) const; |
207 void AdvanceCommitStateIfPossible(); | 213 void AdvanceCommitStateIfPossible(); |
208 bool IsBeginMainFrameSentOrStarted() const; | 214 bool IsBeginMainFrameSentOrStarted() const; |
209 void BeginRetroFrame(); | 215 void BeginRetroFrame(); |
210 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); | 216 void BeginImplFrameWithDeadline(const BeginFrameArgs& args); |
211 void BeginImplFrameSynchronous(const BeginFrameArgs& args); | 217 void BeginImplFrameSynchronous(const BeginFrameArgs& args); |
212 void BeginImplFrame(const BeginFrameArgs& args); | 218 void BeginImplFrame(const BeginFrameArgs& args); |
213 void FinishImplFrame(); | 219 void FinishImplFrame(); |
214 void OnBeginImplFrameDeadline(); | 220 void OnBeginImplFrameDeadline(); |
215 void PollToAdvanceCommitState(); | 221 void PollToAdvanceCommitState(); |
216 | 222 |
(...skipping 14 matching lines...) Expand all Loading... |
231 } | 237 } |
232 | 238 |
233 base::WeakPtrFactory<Scheduler> weak_factory_; | 239 base::WeakPtrFactory<Scheduler> weak_factory_; |
234 | 240 |
235 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 241 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
236 }; | 242 }; |
237 | 243 |
238 } // namespace cc | 244 } // namespace cc |
239 | 245 |
240 #endif // CC_SCHEDULER_SCHEDULER_H_ | 246 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |