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 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 void Scheduler::SetVisible(bool visible) { | 37 void Scheduler::SetVisible(bool visible) { |
38 state_machine_.SetVisible(visible); | 38 state_machine_.SetVisible(visible); |
39 ProcessScheduledActions(); | 39 ProcessScheduledActions(); |
40 } | 40 } |
41 | 41 |
42 void Scheduler::SetCanDraw(bool can_draw) { | 42 void Scheduler::SetCanDraw(bool can_draw) { |
43 state_machine_.SetCanDraw(can_draw); | 43 state_machine_.SetCanDraw(can_draw); |
44 ProcessScheduledActions(); | 44 ProcessScheduledActions(); |
45 } | 45 } |
46 | 46 |
47 void Scheduler::SetHasPendingTree(bool has_pending_tree) { | 47 void Scheduler::NotifyReadyToActivate() { |
48 state_machine_.SetHasPendingTree(has_pending_tree); | 48 state_machine_.NotifyReadyToActivate(); |
49 ProcessScheduledActions(); | 49 ProcessScheduledActions(); |
50 } | 50 } |
51 | 51 |
| 52 void Scheduler::SetHasTrees(bool has_pending_tree, bool active_tree_is_null) { |
| 53 state_machine_.SetHasTrees(has_pending_tree, active_tree_is_null); |
| 54 ProcessScheduledActions(); |
| 55 } |
| 56 |
52 void Scheduler::SetNeedsCommit() { | 57 void Scheduler::SetNeedsCommit() { |
53 state_machine_.SetNeedsCommit(); | 58 state_machine_.SetNeedsCommit(); |
54 ProcessScheduledActions(); | 59 ProcessScheduledActions(); |
55 } | 60 } |
56 | 61 |
57 void Scheduler::SetNeedsForcedCommit() { | 62 void Scheduler::SetNeedsForcedCommit() { |
58 state_machine_.SetNeedsCommit(); | 63 state_machine_.SetNeedsCommit(); |
59 state_machine_.SetNeedsForcedCommit(); | 64 state_machine_.SetNeedsForcedCommit(); |
60 ProcessScheduledActions(); | 65 ProcessScheduledActions(); |
61 } | 66 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 break; | 218 break; |
214 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: | 219 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: |
215 client_->ScheduledActionSendBeginFrameToMainThread(); | 220 client_->ScheduledActionSendBeginFrameToMainThread(); |
216 break; | 221 break; |
217 case SchedulerStateMachine::ACTION_COMMIT: | 222 case SchedulerStateMachine::ACTION_COMMIT: |
218 client_->ScheduledActionCommit(); | 223 client_->ScheduledActionCommit(); |
219 break; | 224 break; |
220 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: | 225 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: |
221 client_->ScheduledActionUpdateVisibleTiles(); | 226 client_->ScheduledActionUpdateVisibleTiles(); |
222 break; | 227 break; |
223 case SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED: | 228 case SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE: |
224 client_->ScheduledActionActivatePendingTreeIfNeeded(); | 229 client_->ScheduledActionActivatePendingTree(); |
225 break; | 230 break; |
226 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: | 231 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: |
227 DrawAndSwapIfPossible(); | 232 DrawAndSwapIfPossible(); |
228 break; | 233 break; |
229 case SchedulerStateMachine::ACTION_DRAW_FORCED: | 234 case SchedulerStateMachine::ACTION_DRAW_FORCED: |
230 DrawAndSwapForced(); | 235 DrawAndSwapForced(); |
231 break; | 236 break; |
232 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: | 237 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: |
233 // No action is actually performed, but this allows the state machine to | 238 // No action is actually performed, but this allows the state machine to |
234 // advance out of its waiting to draw state without actually drawing. | 239 // advance out of its waiting to draw state without actually drawing. |
235 break; | 240 break; |
236 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 241 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
237 client_->ScheduledActionBeginOutputSurfaceCreation(); | 242 client_->ScheduledActionBeginOutputSurfaceCreation(); |
238 break; | 243 break; |
239 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: | 244 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: |
240 client_->ScheduledActionAcquireLayerTexturesForMainThread(); | 245 client_->ScheduledActionAcquireLayerTexturesForMainThread(); |
241 break; | 246 break; |
242 } | 247 } |
243 } while (action != SchedulerStateMachine::ACTION_NONE); | 248 } while (action != SchedulerStateMachine::ACTION_NONE); |
244 | 249 |
245 SetupNextBeginFrameIfNeeded(); | 250 SetupNextBeginFrameIfNeeded(); |
246 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 251 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
247 } | 252 } |
248 | 253 |
249 bool Scheduler::WillDrawIfNeeded() const { | 254 bool Scheduler::WillDrawIfNeeded() const { |
250 return !state_machine_.PendingDrawsShouldBeAborted(); | 255 return !state_machine_.PendingDrawsShouldBeAborted(); |
251 } | 256 } |
252 | 257 |
253 } // namespace cc | 258 } // namespace cc |
OLD | NEW |