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_STATE_MACHINE_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 6 #define CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "cc/output/begin_frame_args.h" | 14 #include "cc/output/begin_frame_args.h" |
| 15 #include "cc/scheduler/commit_earlyout_reason.h" |
15 #include "cc/scheduler/draw_result.h" | 16 #include "cc/scheduler/draw_result.h" |
16 #include "cc/scheduler/scheduler_settings.h" | 17 #include "cc/scheduler/scheduler_settings.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 namespace debug { | 20 namespace debug { |
20 class ConvertableToTraceFormat; | 21 class ConvertableToTraceFormat; |
21 class TracedValue; | 22 class TracedValue; |
22 } | 23 } |
23 class Value; | 24 class Value; |
24 } | 25 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // thread to main. | 200 // thread to main. |
200 void SetNeedsCommit(); | 201 void SetNeedsCommit(); |
201 | 202 |
202 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 203 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
203 // from NextAction. | 204 // from NextAction. |
204 // Indicates that all painting is complete. | 205 // Indicates that all painting is complete. |
205 void NotifyReadyToCommit(); | 206 void NotifyReadyToCommit(); |
206 | 207 |
207 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME | 208 // Call this only in response to receiving an ACTION_SEND_BEGIN_MAIN_FRAME |
208 // from NextAction if the client rejects the BeginMainFrame message. | 209 // from NextAction if the client rejects the BeginMainFrame message. |
209 // If did_handle is false, then another commit will be retried soon. | 210 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
210 void BeginMainFrameAborted(bool did_handle); | |
211 | 211 |
212 // Set that we can create the first OutputSurface and start the scheduler. | 212 // Set that we can create the first OutputSurface and start the scheduler. |
213 void SetCanStart() { can_start_ = true; } | 213 void SetCanStart() { can_start_ = true; } |
| 214 // Allow access of the can_start_ state in tests. |
| 215 bool CanStartForTesting() const { return can_start_; } |
214 | 216 |
215 void SetSkipNextBeginMainFrameToReduceLatency(); | 217 void SetSkipNextBeginMainFrameToReduceLatency(); |
216 | 218 |
217 // Indicates whether drawing would, at this time, make sense. | 219 // Indicates whether drawing would, at this time, make sense. |
218 // CanDraw can be used to suppress flashes or checkerboarding | 220 // CanDraw can be used to suppress flashes or checkerboarding |
219 // when such behavior would be undesirable. | 221 // when such behavior would be undesirable. |
220 void SetCanDraw(bool can); | 222 void SetCanDraw(bool can); |
221 | 223 |
222 // Indicates that scheduled BeginMainFrame is started. | 224 // Indicates that scheduled BeginMainFrame is started. |
223 void NotifyBeginMainFrameStarted(); | 225 void NotifyBeginMainFrameStarted(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 bool ShouldSendBeginMainFrame() const; | 281 bool ShouldSendBeginMainFrame() const; |
280 bool ShouldCommit() const; | 282 bool ShouldCommit() const; |
281 bool ShouldPrepareTiles() const; | 283 bool ShouldPrepareTiles() const; |
282 | 284 |
283 void AdvanceCurrentFrameNumber(); | 285 void AdvanceCurrentFrameNumber(); |
284 bool HasAnimatedThisFrame() const; | 286 bool HasAnimatedThisFrame() const; |
285 bool HasSentBeginMainFrameThisFrame() const; | 287 bool HasSentBeginMainFrameThisFrame() const; |
286 bool HasRequestedSwapThisFrame() const; | 288 bool HasRequestedSwapThisFrame() const; |
287 bool HasSwappedThisFrame() const; | 289 bool HasSwappedThisFrame() const; |
288 | 290 |
289 void UpdateStateOnCommit(bool commit_was_aborted); | 291 void UpdateStateOnCommit(bool commit_had_no_updates); |
290 void UpdateStateOnActivation(); | 292 void UpdateStateOnActivation(); |
291 void UpdateStateOnDraw(bool did_request_swap); | 293 void UpdateStateOnDraw(bool did_request_swap); |
292 void UpdateStateOnPrepareTiles(); | 294 void UpdateStateOnPrepareTiles(); |
293 | 295 |
294 const SchedulerSettings settings_; | 296 const SchedulerSettings settings_; |
295 | 297 |
296 OutputSurfaceState output_surface_state_; | 298 OutputSurfaceState output_surface_state_; |
297 BeginImplFrameState begin_impl_frame_state_; | 299 BeginImplFrameState begin_impl_frame_state_; |
298 CommitState commit_state_; | 300 CommitState commit_state_; |
299 ForcedRedrawOnTimeoutState forced_redraw_state_; | 301 ForcedRedrawOnTimeoutState forced_redraw_state_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 bool impl_latency_takes_priority_on_battery_; | 337 bool impl_latency_takes_priority_on_battery_; |
336 bool children_need_begin_frames_; | 338 bool children_need_begin_frames_; |
337 | 339 |
338 private: | 340 private: |
339 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); | 341 DISALLOW_COPY_AND_ASSIGN(SchedulerStateMachine); |
340 }; | 342 }; |
341 | 343 |
342 } // namespace cc | 344 } // namespace cc |
343 | 345 |
344 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ | 346 #endif // CC_SCHEDULER_SCHEDULER_STATE_MACHINE_H_ |
OLD | NEW |