| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed. | 639 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed. |
| 640 tracked_objects::ScopedTracker tracking_profile1( | 640 tracked_objects::ScopedTracker tracking_profile1( |
| 641 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 641 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 642 "461509 Scheduler::OnBeginImplFrameDeadline1")); | 642 "461509 Scheduler::OnBeginImplFrameDeadline1")); |
| 643 state_machine_.OnBeginImplFrameDeadline(); | 643 state_machine_.OnBeginImplFrameDeadline(); |
| 644 ProcessScheduledActions(); | 644 ProcessScheduledActions(); |
| 645 FinishImplFrame(); | 645 FinishImplFrame(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void Scheduler::DrawAndSwapIfPossible() { | 648 void Scheduler::DrawAndSwapIfPossible() { |
| 649 state_machine_.WillDraw(); |
| 649 compositor_timing_history_->WillDraw(); | 650 compositor_timing_history_->WillDraw(); |
| 650 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); | 651 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
| 651 state_machine_.DidDrawIfPossibleCompleted(result); | |
| 652 compositor_timing_history_->DidDraw(); | 652 compositor_timing_history_->DidDraw(); |
| 653 state_machine_.DidDraw(result); |
| 653 } | 654 } |
| 654 | 655 |
| 655 void Scheduler::DrawAndSwapForced() { | 656 void Scheduler::DrawAndSwapForced() { |
| 657 state_machine_.WillDraw(); |
| 656 compositor_timing_history_->WillDraw(); | 658 compositor_timing_history_->WillDraw(); |
| 657 client_->ScheduledActionDrawAndSwapForced(); | 659 DrawResult result = client_->ScheduledActionDrawAndSwapForced(); |
| 658 compositor_timing_history_->DidDraw(); | 660 compositor_timing_history_->DidDraw(); |
| 661 state_machine_.DidDraw(result); |
| 659 } | 662 } |
| 660 | 663 |
| 661 void Scheduler::SetDeferCommits(bool defer_commits) { | 664 void Scheduler::SetDeferCommits(bool defer_commits) { |
| 662 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", | 665 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", |
| 663 "defer_commits", | 666 "defer_commits", |
| 664 defer_commits); | 667 defer_commits); |
| 665 state_machine_.SetDeferCommits(defer_commits); | 668 state_machine_.SetDeferCommits(defer_commits); |
| 666 ProcessScheduledActions(); | 669 ProcessScheduledActions(); |
| 667 } | 670 } |
| 668 | 671 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 state_machine_.WillActivate(); | 716 state_machine_.WillActivate(); |
| 714 client_->ScheduledActionActivateSyncTree(); | 717 client_->ScheduledActionActivateSyncTree(); |
| 715 compositor_timing_history_->DidActivate(); | 718 compositor_timing_history_->DidActivate(); |
| 716 break; | 719 break; |
| 717 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { | 720 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { |
| 718 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is | 721 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is |
| 719 // fixed. | 722 // fixed. |
| 720 tracked_objects::ScopedTracker tracking_profile6( | 723 tracked_objects::ScopedTracker tracking_profile6( |
| 721 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 724 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 722 "461509 Scheduler::ProcessScheduledActions6")); | 725 "461509 Scheduler::ProcessScheduledActions6")); |
| 723 bool did_request_swap = true; | |
| 724 state_machine_.WillDraw(did_request_swap); | |
| 725 DrawAndSwapIfPossible(); | 726 DrawAndSwapIfPossible(); |
| 726 break; | 727 break; |
| 727 } | 728 } |
| 728 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: { | 729 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: |
| 729 bool did_request_swap = true; | |
| 730 state_machine_.WillDraw(did_request_swap); | |
| 731 DrawAndSwapForced(); | 730 DrawAndSwapForced(); |
| 732 break; | 731 break; |
| 733 } | |
| 734 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { | 732 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { |
| 735 // No action is actually performed, but this allows the state machine to | 733 // No action is actually performed, but this allows the state machine to |
| 736 // advance out of its waiting to draw state without actually drawing. | 734 // drain the pipeline without actually drawing. |
| 737 bool did_request_swap = false; | 735 state_machine_.AbortDrawAndSwap(); |
| 738 state_machine_.WillDraw(did_request_swap); | |
| 739 break; | 736 break; |
| 740 } | 737 } |
| 741 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: | 738 case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION: |
| 742 state_machine_.WillBeginOutputSurfaceCreation(); | 739 state_machine_.WillBeginOutputSurfaceCreation(); |
| 743 client_->ScheduledActionBeginOutputSurfaceCreation(); | 740 client_->ScheduledActionBeginOutputSurfaceCreation(); |
| 744 break; | 741 break; |
| 745 case SchedulerStateMachine::ACTION_PREPARE_TILES: | 742 case SchedulerStateMachine::ACTION_PREPARE_TILES: |
| 746 state_machine_.WillPrepareTiles(); | 743 state_machine_.WillPrepareTiles(); |
| 747 client_->ScheduledActionPrepareTiles(); | 744 client_->ScheduledActionPrepareTiles(); |
| 748 break; | 745 break; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 } | 886 } |
| 890 | 887 |
| 891 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 888 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 892 return (state_machine_.begin_main_frame_state() == | 889 return (state_machine_.begin_main_frame_state() == |
| 893 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 890 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
| 894 state_machine_.begin_main_frame_state() == | 891 state_machine_.begin_main_frame_state() == |
| 895 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 892 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
| 896 } | 893 } |
| 897 | 894 |
| 898 } // namespace cc | 895 } // namespace cc |
| OLD | NEW |