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::SetNeedsCommit() { | 52 void Scheduler::SetNeedsCommit() { |
53 state_machine_.SetNeedsCommit(); | 53 state_machine_.SetNeedsCommit(); |
54 ProcessScheduledActions(); | 54 ProcessScheduledActions(); |
55 } | 55 } |
56 | 56 |
57 void Scheduler::SetNeedsForcedCommit() { | 57 void Scheduler::SetNeedsForcedCommit() { |
58 state_machine_.SetNeedsCommit(); | 58 state_machine_.SetNeedsCommit(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 break; | 213 break; |
214 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: | 214 case SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD: |
215 client_->ScheduledActionSendBeginFrameToMainThread(); | 215 client_->ScheduledActionSendBeginFrameToMainThread(); |
216 break; | 216 break; |
217 case SchedulerStateMachine::ACTION_COMMIT: | 217 case SchedulerStateMachine::ACTION_COMMIT: |
218 client_->ScheduledActionCommit(); | 218 client_->ScheduledActionCommit(); |
219 break; | 219 break; |
220 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: | 220 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: |
221 client_->ScheduledActionUpdateVisibleTiles(); | 221 client_->ScheduledActionUpdateVisibleTiles(); |
222 break; | 222 break; |
223 case SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE_IF_NEEDED: | 223 case SchedulerStateMachine::ACTION_ACTIVATE_PENDING_TREE: |
224 client_->ScheduledActionActivatePendingTreeIfNeeded(); | 224 client_->ScheduledActionActivatePendingTree(); |
225 break; | 225 break; |
226 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: | 226 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: |
227 DrawAndSwapIfPossible(); | 227 DrawAndSwapIfPossible(); |
228 break; | 228 break; |
229 case SchedulerStateMachine::ACTION_DRAW_FORCED: | 229 case SchedulerStateMachine::ACTION_DRAW_FORCED: |
230 DrawAndSwapForced(); | 230 DrawAndSwapForced(); |
231 break; | 231 break; |
232 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: | 232 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: |
233 // No action is actually performed, but this allows the state machine to | 233 // No action is actually performed, but this allows the state machine to |
234 // advance out of its waiting to draw state without actually drawing. | 234 // advance out of its waiting to draw state without actually drawing. |
235 break; | 235 break; |
236 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 236 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
237 client_->ScheduledActionBeginOutputSurfaceCreation(); | 237 client_->ScheduledActionBeginOutputSurfaceCreation(); |
238 break; | 238 break; |
239 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: | 239 case SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD: |
240 client_->ScheduledActionAcquireLayerTexturesForMainThread(); | 240 client_->ScheduledActionAcquireLayerTexturesForMainThread(); |
241 break; | 241 break; |
242 } | 242 } |
243 } while (action != SchedulerStateMachine::ACTION_NONE); | 243 } while (action != SchedulerStateMachine::ACTION_NONE); |
244 | 244 |
245 SetupNextBeginFrameIfNeeded(); | 245 SetupNextBeginFrameIfNeeded(); |
246 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 246 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
247 } | 247 } |
248 | 248 |
249 bool Scheduler::WillDrawIfNeeded() const { | 249 bool Scheduler::WillDrawIfNeeded() const { |
250 return !state_machine_.PendingDrawsShouldBeAborted(); | 250 return !state_machine_.PendingDrawsShouldBeAborted(); |
251 } | 251 } |
252 | 252 |
253 } // namespace cc | 253 } // namespace cc |
OLD | NEW |