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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); | 629 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); |
630 advance_commit_state_task_.Cancel(); | 630 advance_commit_state_task_.Cancel(); |
631 ProcessScheduledActions(); | 631 ProcessScheduledActions(); |
632 } | 632 } |
633 | 633 |
634 void Scheduler::DrawAndSwapIfPossible() { | 634 void Scheduler::DrawAndSwapIfPossible() { |
635 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); | 635 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
636 state_machine_.DidDrawIfPossibleCompleted(result); | 636 state_machine_.DidDrawIfPossibleCompleted(result); |
637 } | 637 } |
638 | 638 |
| 639 void Scheduler::SetDeferCommits(bool defer_commits) { |
| 640 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", |
| 641 "defer_commits", |
| 642 defer_commits); |
| 643 state_machine_.SetDeferCommits(defer_commits); |
| 644 ProcessScheduledActions(); |
| 645 } |
| 646 |
639 void Scheduler::ProcessScheduledActions() { | 647 void Scheduler::ProcessScheduledActions() { |
640 // We do not allow ProcessScheduledActions to be recursive. | 648 // We do not allow ProcessScheduledActions to be recursive. |
641 // The top-level call will iteratively execute the next action for us anyway. | 649 // The top-level call will iteratively execute the next action for us anyway. |
642 if (inside_process_scheduled_actions_) | 650 if (inside_process_scheduled_actions_) |
643 return; | 651 return; |
644 | 652 |
645 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); | 653 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); |
646 | 654 |
647 SchedulerStateMachine::Action action; | 655 SchedulerStateMachine::Action action; |
648 do { | 656 do { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 792 } |
785 | 793 |
786 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 794 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
787 return (state_machine_.commit_state() == | 795 return (state_machine_.commit_state() == |
788 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 796 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
789 state_machine_.commit_state() == | 797 state_machine_.commit_state() == |
790 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 798 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
791 } | 799 } |
792 | 800 |
793 } // namespace cc | 801 } // namespace cc |
OLD | NEW |