| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed. | 599 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed. |
| 600 tracked_objects::ScopedTracker tracking_profile1( | 600 tracked_objects::ScopedTracker tracking_profile1( |
| 601 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 601 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 602 "461509 Scheduler::OnBeginImplFrameDeadline1")); | 602 "461509 Scheduler::OnBeginImplFrameDeadline1")); |
| 603 state_machine_.OnBeginImplFrameDeadline(); | 603 state_machine_.OnBeginImplFrameDeadline(); |
| 604 ProcessScheduledActions(); | 604 ProcessScheduledActions(); |
| 605 FinishImplFrame(); | 605 FinishImplFrame(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 void Scheduler::DrawAndSwapIfPossible() { | 608 void Scheduler::DrawAndSwapIfPossible() { |
| 609 state_machine_.WillDraw(); |
| 609 compositor_timing_history_->WillDraw(); | 610 compositor_timing_history_->WillDraw(); |
| 610 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); | 611 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
| 611 state_machine_.DidDrawIfPossibleCompleted(result); | |
| 612 compositor_timing_history_->DidDraw(); | 612 compositor_timing_history_->DidDraw(); |
| 613 bool did_request_swap = true; |
| 614 state_machine_.DidDraw(did_request_swap, result); |
| 613 } | 615 } |
| 614 | 616 |
| 615 void Scheduler::DrawAndSwapForced() { | 617 void Scheduler::DrawAndSwapForced() { |
| 618 state_machine_.WillDraw(); |
| 616 compositor_timing_history_->WillDraw(); | 619 compositor_timing_history_->WillDraw(); |
| 617 client_->ScheduledActionDrawAndSwapForced(); | 620 DrawResult result = client_->ScheduledActionDrawAndSwapForced(); |
| 618 compositor_timing_history_->DidDraw(); | 621 compositor_timing_history_->DidDraw(); |
| 622 bool did_request_swap = true; |
| 623 state_machine_.DidDraw(did_request_swap, result); |
| 619 } | 624 } |
| 620 | 625 |
| 621 void Scheduler::SetDeferCommits(bool defer_commits) { | 626 void Scheduler::SetDeferCommits(bool defer_commits) { |
| 622 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", | 627 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", |
| 623 "defer_commits", | 628 "defer_commits", |
| 624 defer_commits); | 629 defer_commits); |
| 625 state_machine_.SetDeferCommits(defer_commits); | 630 state_machine_.SetDeferCommits(defer_commits); |
| 626 ProcessScheduledActions(); | 631 ProcessScheduledActions(); |
| 627 } | 632 } |
| 628 | 633 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 state_machine_.WillActivate(); | 678 state_machine_.WillActivate(); |
| 674 client_->ScheduledActionActivateSyncTree(); | 679 client_->ScheduledActionActivateSyncTree(); |
| 675 compositor_timing_history_->DidActivate(); | 680 compositor_timing_history_->DidActivate(); |
| 676 break; | 681 break; |
| 677 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { | 682 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { |
| 678 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is | 683 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is |
| 679 // fixed. | 684 // fixed. |
| 680 tracked_objects::ScopedTracker tracking_profile6( | 685 tracked_objects::ScopedTracker tracking_profile6( |
| 681 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 686 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 682 "461509 Scheduler::ProcessScheduledActions6")); | 687 "461509 Scheduler::ProcessScheduledActions6")); |
| 683 bool did_request_swap = true; | |
| 684 state_machine_.WillDraw(did_request_swap); | |
| 685 DrawAndSwapIfPossible(); | 688 DrawAndSwapIfPossible(); |
| 686 break; | 689 break; |
| 687 } | 690 } |
| 688 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: { | 691 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: |
| 689 bool did_request_swap = true; | |
| 690 state_machine_.WillDraw(did_request_swap); | |
| 691 DrawAndSwapForced(); | 692 DrawAndSwapForced(); |
| 692 break; | 693 break; |
| 693 } | |
| 694 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { | 694 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { |
| 695 // No action is actually performed, but this allows the state machine to | 695 // No action is actually performed, but this allows the state machine to |
| 696 // advance out of its waiting to draw state without actually drawing. | 696 // advance out of its waiting to draw state without actually drawing. |
| 697 bool did_request_swap = false; | 697 bool did_request_swap = false; |
| 698 state_machine_.WillDraw(did_request_swap); | 698 state_machine_.WillDraw(); |
| 699 state_machine_.DidDraw(did_request_swap, DRAW_SUCCESS); |
| 699 break; | 700 break; |
| 700 } | 701 } |
| 701 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 702 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
| 702 state_machine_.WillBeginOutputSurfaceCreation(); | 703 state_machine_.WillBeginOutputSurfaceCreation(); |
| 703 client_->ScheduledActionBeginOutputSurfaceCreation(); | 704 client_->ScheduledActionBeginOutputSurfaceCreation(); |
| 704 break; | 705 break; |
| 705 case SchedulerStateMachine::ACTION_PREPARE_TILES: | 706 case SchedulerStateMachine::ACTION_PREPARE_TILES: |
| 706 state_machine_.WillPrepareTiles(); | 707 state_machine_.WillPrepareTiles(); |
| 707 client_->ScheduledActionPrepareTiles(); | 708 client_->ScheduledActionPrepareTiles(); |
| 708 break; | 709 break; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 } | 848 } |
| 848 | 849 |
| 849 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 850 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 850 return (state_machine_.begin_main_frame_state() == | 851 return (state_machine_.begin_main_frame_state() == |
| 851 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 852 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
| 852 state_machine_.begin_main_frame_state() == | 853 state_machine_.begin_main_frame_state() == |
| 853 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 854 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
| 854 } | 855 } |
| 855 | 856 |
| 856 } // namespace cc | 857 } // namespace cc |
| OLD | NEW |