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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 void Scheduler::OnBeginImplFrameDeadline() { | 585 void Scheduler::OnBeginImplFrameDeadline() { |
586 TRACE_EVENT0("cc,benchmark", "Scheduler::OnBeginImplFrameDeadline"); | 586 TRACE_EVENT0("cc,benchmark", "Scheduler::OnBeginImplFrameDeadline"); |
587 begin_impl_frame_deadline_task_.Cancel(); | 587 begin_impl_frame_deadline_task_.Cancel(); |
588 // We split the deadline actions up into two phases so the state machine | 588 // We split the deadline actions up into two phases so the state machine |
589 // has a chance to trigger actions that should occur durring and after | 589 // has a chance to trigger actions that should occur durring and after |
590 // the deadline separately. For example: | 590 // the deadline separately. For example: |
591 // * Sending the BeginMainFrame will not occur after the deadline in | 591 // * Sending the BeginMainFrame will not occur after the deadline in |
592 // order to wait for more user-input before starting the next commit. | 592 // order to wait for more user-input before starting the next commit. |
593 // * Creating a new OuputSurface will not occur during the deadline in | 593 // * Creating a new OuputSurface will not occur during the deadline in |
594 // order to allow the state machine to "settle" first. | 594 // order to allow the state machine to "settle" first. |
595 | |
596 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed. | |
597 tracked_objects::ScopedTracker tracking_profile1( | |
598 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
599 "461509 Scheduler::OnBeginImplFrameDeadline1")); | |
600 compositor_timing_history_->WillFinishImplFrame( | 595 compositor_timing_history_->WillFinishImplFrame( |
601 state_machine_.needs_redraw()); | 596 state_machine_.needs_redraw()); |
602 state_machine_.OnBeginImplFrameDeadline(); | 597 state_machine_.OnBeginImplFrameDeadline(); |
603 ProcessScheduledActions(); | 598 ProcessScheduledActions(); |
604 FinishImplFrame(); | 599 FinishImplFrame(); |
605 } | 600 } |
606 | 601 |
607 void Scheduler::DrawAndSwapIfPossible() { | 602 void Scheduler::DrawAndSwapIfPossible() { |
608 bool drawing_with_new_active_tree = | 603 bool drawing_with_new_active_tree = |
609 state_machine_.active_tree_needs_first_draw(); | 604 state_machine_.active_tree_needs_first_draw(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 break; | 654 break; |
660 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: | 655 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: |
661 compositor_timing_history_->WillBeginMainFrame( | 656 compositor_timing_history_->WillBeginMainFrame( |
662 begin_main_frame_args_.on_critical_path, | 657 begin_main_frame_args_.on_critical_path, |
663 begin_main_frame_args_.frame_time); | 658 begin_main_frame_args_.frame_time); |
664 state_machine_.WillSendBeginMainFrame(); | 659 state_machine_.WillSendBeginMainFrame(); |
665 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. | 660 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. |
666 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); | 661 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); |
667 break; | 662 break; |
668 case SchedulerStateMachine::ACTION_COMMIT: { | 663 case SchedulerStateMachine::ACTION_COMMIT: { |
669 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is | |
670 // fixed. | |
671 tracked_objects::ScopedTracker tracking_profile4( | |
672 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
673 "461509 Scheduler::ProcessScheduledActions4")); | |
674 bool commit_has_no_updates = false; | 664 bool commit_has_no_updates = false; |
675 state_machine_.WillCommit(commit_has_no_updates); | 665 state_machine_.WillCommit(commit_has_no_updates); |
676 client_->ScheduledActionCommit(); | 666 client_->ScheduledActionCommit(); |
677 break; | 667 break; |
678 } | 668 } |
679 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: | 669 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: |
680 compositor_timing_history_->WillActivate(); | 670 compositor_timing_history_->WillActivate(); |
681 state_machine_.WillActivate(); | 671 state_machine_.WillActivate(); |
682 client_->ScheduledActionActivateSyncTree(); | 672 client_->ScheduledActionActivateSyncTree(); |
683 compositor_timing_history_->DidActivate(); | 673 compositor_timing_history_->DidActivate(); |
684 break; | 674 break; |
685 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: { | 675 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: |
686 // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is | |
687 // fixed. | |
688 tracked_objects::ScopedTracker tracking_profile6( | |
689 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
690 "461509 Scheduler::ProcessScheduledActions6")); | |
691 DrawAndSwapIfPossible(); | 676 DrawAndSwapIfPossible(); |
692 break; | 677 break; |
693 } | |
694 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: | 678 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED: |
695 DrawAndSwapForced(); | 679 DrawAndSwapForced(); |
696 break; | 680 break; |
697 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { | 681 case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT: { |
698 // No action is actually performed, but this allows the state machine to | 682 // No action is actually performed, but this allows the state machine to |
699 // drain the pipeline without actually drawing. | 683 // drain the pipeline without actually drawing. |
700 state_machine_.AbortDrawAndSwap(); | 684 state_machine_.AbortDrawAndSwap(); |
701 compositor_timing_history_->DrawAborted(); | 685 compositor_timing_history_->DrawAborted(); |
702 break; | 686 break; |
703 } | 687 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 } | 818 } |
835 | 819 |
836 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 820 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
837 return (state_machine_.begin_main_frame_state() == | 821 return (state_machine_.begin_main_frame_state() == |
838 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || | 822 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || |
839 state_machine_.begin_main_frame_state() == | 823 state_machine_.begin_main_frame_state() == |
840 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); | 824 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); |
841 } | 825 } |
842 | 826 |
843 } // namespace cc | 827 } // namespace cc |
OLD | NEW |