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" |
11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
15 #include "cc/debug/devtools_instrumentation.h" | |
16 #include "cc/debug/traced_value.h" | 15 #include "cc/debug/traced_value.h" |
17 #include "cc/scheduler/delay_based_time_source.h" | 16 #include "cc/scheduler/delay_based_time_source.h" |
18 #include "ui/gfx/frame_time.h" | 17 #include "ui/gfx/frame_time.h" |
19 | 18 |
20 namespace cc { | 19 namespace cc { |
21 | 20 |
22 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( | 21 BeginFrameSource* SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( |
23 Scheduler* scheduler) { | 22 Scheduler* scheduler) { |
24 if (scheduler->settings_.use_external_begin_frame_source) { | 23 if (scheduler->settings_.use_external_begin_frame_source) { |
25 TRACE_EVENT1("cc", | 24 TRACE_EVENT1("cc", |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 begin_impl_frame_args_ = args; | 527 begin_impl_frame_args_ = args; |
529 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); | 528 begin_impl_frame_args_.deadline -= client_->DrawDurationEstimate(); |
530 | 529 |
531 if (!state_machine_.impl_latency_takes_priority() && | 530 if (!state_machine_.impl_latency_takes_priority() && |
532 main_thread_is_in_high_latency_mode && | 531 main_thread_is_in_high_latency_mode && |
533 CanCommitAndActivateBeforeDeadline()) { | 532 CanCommitAndActivateBeforeDeadline()) { |
534 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); | 533 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); |
535 } | 534 } |
536 | 535 |
537 state_machine_.OnBeginImplFrame(); | 536 state_machine_.OnBeginImplFrame(); |
538 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); | |
539 client_->WillBeginImplFrame(begin_impl_frame_args_); | 537 client_->WillBeginImplFrame(begin_impl_frame_args_); |
540 | 538 |
541 ProcessScheduledActions(); | 539 ProcessScheduledActions(); |
542 | 540 |
543 state_machine_.OnBeginImplFrameDeadlinePending(); | 541 state_machine_.OnBeginImplFrameDeadlinePending(); |
544 | 542 |
545 if (settings_.using_synchronous_renderer_compositor) { | 543 if (settings_.using_synchronous_renderer_compositor) { |
546 // The synchronous renderer compositor has to make its GL calls | 544 // The synchronous renderer compositor has to make its GL calls |
547 // within this call. | 545 // within this call. |
548 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks | 546 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 } | 827 } |
830 | 828 |
831 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 829 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
832 return (state_machine_.commit_state() == | 830 return (state_machine_.commit_state() == |
833 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 831 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
834 state_machine_.commit_state() == | 832 state_machine_.commit_state() == |
835 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 833 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
836 } | 834 } |
837 | 835 |
838 } // namespace cc | 836 } // namespace cc |
OLD | NEW |