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" | |
11 #include "base/debug/trace_event_argument.h" | |
12 #include "base/logging.h" | 10 #include "base/logging.h" |
13 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" |
14 #include "cc/debug/devtools_instrumentation.h" | 14 #include "cc/debug/devtools_instrumentation.h" |
15 #include "cc/debug/traced_value.h" | 15 #include "cc/debug/traced_value.h" |
16 #include "cc/scheduler/delay_based_time_source.h" | 16 #include "cc/scheduler/delay_based_time_source.h" |
17 #include "ui/gfx/frame_time.h" | 17 #include "ui/gfx/frame_time.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( | 21 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( |
22 Scheduler* scheduler) { | 22 Scheduler* scheduler) { |
23 if (scheduler->settings_.use_external_begin_frame_source) { | 23 if (scheduler->settings_.use_external_begin_frame_source) { |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); | 664 TRACE_EVENT0("cc", "Scheduler::PollToAdvanceCommitState"); |
665 advance_commit_state_task_.Cancel(); | 665 advance_commit_state_task_.Cancel(); |
666 ProcessScheduledActions(); | 666 ProcessScheduledActions(); |
667 } | 667 } |
668 | 668 |
669 void Scheduler::DrawAndSwapIfPossible() { | 669 void Scheduler::DrawAndSwapIfPossible() { |
670 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); | 670 DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible(); |
671 state_machine_.DidDrawIfPossibleCompleted(result); | 671 state_machine_.DidDrawIfPossibleCompleted(result); |
672 } | 672 } |
673 | 673 |
| 674 void Scheduler::SetDeferCommits(bool defer_commits) { |
| 675 TRACE_EVENT1("cc", "Scheduler::SetDeferCommits", |
| 676 "defer_commits", |
| 677 defer_commits); |
| 678 state_machine_.SetDeferCommits(defer_commits); |
| 679 ProcessScheduledActions(); |
| 680 } |
| 681 |
674 void Scheduler::ProcessScheduledActions() { | 682 void Scheduler::ProcessScheduledActions() { |
675 // We do not allow ProcessScheduledActions to be recursive. | 683 // We do not allow ProcessScheduledActions to be recursive. |
676 // The top-level call will iteratively execute the next action for us anyway. | 684 // The top-level call will iteratively execute the next action for us anyway. |
677 if (inside_process_scheduled_actions_) | 685 if (inside_process_scheduled_actions_) |
678 return; | 686 return; |
679 | 687 |
680 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); | 688 base::AutoReset<bool> mark_inside(&inside_process_scheduled_actions_, true); |
681 | 689 |
682 SchedulerStateMachine::Action action; | 690 SchedulerStateMachine::Action action; |
683 do { | 691 do { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 818 } |
811 | 819 |
812 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 820 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
813 return (state_machine_.commit_state() == | 821 return (state_machine_.commit_state() == |
814 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 822 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
815 state_machine_.commit_state() == | 823 state_machine_.commit_state() == |
816 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 824 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
817 } | 825 } |
818 | 826 |
819 } // namespace cc | 827 } // namespace cc |
OLD | NEW |