OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 helper_.CheckOnValidThread(); | 129 helper_.CheckOnValidThread(); |
130 if (helper_.IsShutdown()) | 130 if (helper_.IsShutdown()) |
131 return; | 131 return; |
132 | 132 |
133 base::TimeTicks now(helper_.Now()); | 133 base::TimeTicks now(helper_.Now()); |
134 if (now < estimated_next_frame_begin_) { | 134 if (now < estimated_next_frame_begin_) { |
135 // TODO(rmcilroy): Consider reducing the idle period based on the runtime of | 135 // TODO(rmcilroy): Consider reducing the idle period based on the runtime of |
136 // the next pending delayed tasks (as currently done in for long idle times) | 136 // the next pending delayed tasks (as currently done in for long idle times) |
137 idle_helper_.StartIdlePeriod( | 137 idle_helper_.StartIdlePeriod( |
138 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, now, | 138 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, now, |
139 estimated_next_frame_begin_, true); | 139 estimated_next_frame_begin_); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 void RendererSchedulerImpl::BeginFrameNotExpectedSoon() { | 143 void RendererSchedulerImpl::BeginFrameNotExpectedSoon() { |
144 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 144 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
145 "RendererSchedulerImpl::BeginFrameNotExpectedSoon"); | 145 "RendererSchedulerImpl::BeginFrameNotExpectedSoon"); |
146 helper_.CheckOnValidThread(); | 146 helper_.CheckOnValidThread(); |
147 if (helper_.IsShutdown()) | 147 if (helper_.IsShutdown()) |
148 return; | 148 return; |
149 | 149 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return true; | 297 return true; |
298 | 298 |
299 default: | 299 default: |
300 NOTREACHED(); | 300 NOTREACHED(); |
301 return false; | 301 return false; |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting() | 305 base::TimeTicks RendererSchedulerImpl::CurrentIdleTaskDeadlineForTesting() |
306 const { | 306 const { |
307 base::TimeTicks deadline; | 307 return idle_helper_.CurrentIdleTaskDeadline(); |
308 idle_helper_.CurrentIdleTaskDeadlineCallback(&deadline); | |
309 return deadline; | |
310 } | 308 } |
311 | 309 |
312 RendererSchedulerImpl::Policy RendererSchedulerImpl::SchedulerPolicy() const { | 310 RendererSchedulerImpl::Policy RendererSchedulerImpl::SchedulerPolicy() const { |
313 helper_.CheckOnValidThread(); | 311 helper_.CheckOnValidThread(); |
314 return current_policy_; | 312 return current_policy_; |
315 } | 313 } |
316 | 314 |
317 void RendererSchedulerImpl::MaybeUpdatePolicy() { | 315 void RendererSchedulerImpl::MaybeUpdatePolicy() { |
318 helper_.CheckOnValidThread(); | 316 helper_.CheckOnValidThread(); |
319 if (policy_may_need_update_.IsSet()) { | 317 if (policy_may_need_update_.IsSet()) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 // meaningful touchstart response and should not impact task priority. | 631 // meaningful touchstart response and should not impact task priority. |
634 return current_state; | 632 return current_state; |
635 | 633 |
636 default: | 634 default: |
637 break; | 635 break; |
638 } | 636 } |
639 return InputStreamState::ACTIVE; | 637 return InputStreamState::ACTIVE; |
640 } | 638 } |
641 | 639 |
642 } // namespace scheduler | 640 } // namespace scheduler |
OLD | NEW |