| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void Scheduler::DidSwapBuffers() { | 237 void Scheduler::DidSwapBuffers() { |
| 238 state_machine_.DidSwapBuffers(); | 238 state_machine_.DidSwapBuffers(); |
| 239 | 239 |
| 240 // There is no need to call ProcessScheduledActions here because | 240 // There is no need to call ProcessScheduledActions here because |
| 241 // swapping should not trigger any new actions. | 241 // swapping should not trigger any new actions. |
| 242 if (!inside_process_scheduled_actions_) { | 242 if (!inside_process_scheduled_actions_) { |
| 243 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); | 243 DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void Scheduler::SetSwapUsedIncompleteTile(bool used_incomplete_tile) { | |
| 248 state_machine_.SetSwapUsedIncompleteTile(used_incomplete_tile); | |
| 249 ProcessScheduledActions(); | |
| 250 } | |
| 251 | |
| 252 void Scheduler::DidSwapBuffersComplete() { | 247 void Scheduler::DidSwapBuffersComplete() { |
| 253 state_machine_.DidSwapBuffersComplete(); | 248 state_machine_.DidSwapBuffersComplete(); |
| 254 ProcessScheduledActions(); | 249 ProcessScheduledActions(); |
| 255 } | 250 } |
| 256 | 251 |
| 257 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { | 252 void Scheduler::SetImplLatencyTakesPriority(bool impl_latency_takes_priority) { |
| 258 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); | 253 state_machine_.SetImplLatencyTakesPriority(impl_latency_takes_priority); |
| 259 ProcessScheduledActions(); | 254 ProcessScheduledActions(); |
| 260 } | 255 } |
| 261 | 256 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 begin_retro_frame_args_.front().AsValue()); | 465 begin_retro_frame_args_.front().AsValue()); |
| 471 begin_retro_frame_args_.pop_front(); | 466 begin_retro_frame_args_.pop_front(); |
| 472 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); | 467 frame_source_->DidFinishFrame(begin_retro_frame_args_.size()); |
| 473 } | 468 } |
| 474 | 469 |
| 475 if (begin_retro_frame_args_.empty()) { | 470 if (begin_retro_frame_args_.empty()) { |
| 476 TRACE_EVENT_INSTANT0("cc", | 471 TRACE_EVENT_INSTANT0("cc", |
| 477 "Scheduler::BeginRetroFrames all expired", | 472 "Scheduler::BeginRetroFrames all expired", |
| 478 TRACE_EVENT_SCOPE_THREAD); | 473 TRACE_EVENT_SCOPE_THREAD); |
| 479 } else { | 474 } else { |
| 480 BeginImplFrame(begin_retro_frame_args_.front()); | 475 BeginFrameArgs front = begin_retro_frame_args_.front(); |
| 481 begin_retro_frame_args_.pop_front(); | 476 begin_retro_frame_args_.pop_front(); |
| 477 BeginImplFrame(front); |
| 482 } | 478 } |
| 483 } | 479 } |
| 484 | 480 |
| 485 // There could be a race between the posted BeginRetroFrame and a new | 481 // There could be a race between the posted BeginRetroFrame and a new |
| 486 // BeginFrame arriving via the normal mechanism. Scheduler::BeginFrame | 482 // BeginFrame arriving via the normal mechanism. Scheduler::BeginFrame |
| 487 // will check if there is a pending BeginRetroFrame to ensure we handle | 483 // will check if there is a pending BeginRetroFrame to ensure we handle |
| 488 // BeginFrames in FIFO order. | 484 // BeginFrames in FIFO order. |
| 489 void Scheduler::PostBeginRetroFrameIfNeeded() { | 485 void Scheduler::PostBeginRetroFrameIfNeeded() { |
| 490 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), | 486 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), |
| 491 "Scheduler::PostBeginRetroFrameIfNeeded", | 487 "Scheduler::PostBeginRetroFrameIfNeeded", |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 break; | 658 break; |
| 663 case SchedulerStateMachine::ACTION_ANIMATE: | 659 case SchedulerStateMachine::ACTION_ANIMATE: |
| 664 client_->ScheduledActionAnimate(); | 660 client_->ScheduledActionAnimate(); |
| 665 break; | 661 break; |
| 666 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: | 662 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: |
| 667 client_->ScheduledActionSendBeginMainFrame(); | 663 client_->ScheduledActionSendBeginMainFrame(); |
| 668 break; | 664 break; |
| 669 case SchedulerStateMachine::ACTION_COMMIT: | 665 case SchedulerStateMachine::ACTION_COMMIT: |
| 670 client_->ScheduledActionCommit(); | 666 client_->ScheduledActionCommit(); |
| 671 break; | 667 break; |
| 672 case SchedulerStateMachine::ACTION_UPDATE_VISIBLE_TILES: | |
| 673 client_->ScheduledActionUpdateVisibleTiles(); | |
| 674 break; | |
| 675 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: | 668 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: |
| 676 client_->ScheduledActionActivateSyncTree(); | 669 client_->ScheduledActionActivateSyncTree(); |
| 677 break; | 670 break; |
| 678 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: | 671 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: |
| 679 DrawAndSwapIfPossible(); | 672 DrawAndSwapIfPossible(); |
| 680 break; | 673 break; |
| 681 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: | 674 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: |
| 682 client_->ScheduledActionDrawAndSwapForced(); | 675 client_->ScheduledActionDrawAndSwapForced(); |
| 683 break; | 676 break; |
| 684 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: | 677 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 } | 777 } |
| 785 | 778 |
| 786 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 779 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 787 return (state_machine_.commit_state() == | 780 return (state_machine_.commit_state() == |
| 788 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 781 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 789 state_machine_.commit_state() == | 782 state_machine_.commit_state() == |
| 790 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 783 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 791 } | 784 } |
| 792 | 785 |
| 793 } // namespace cc | 786 } // namespace cc |
| OLD | NEW |