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 "content/renderer/scheduler/renderer_scheduler_impl.h" | 5 #include "content/renderer/scheduler/renderer_scheduler_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "cc/output/begin_frame_args.h" | 8 #include "cc/output/begin_frame_args.h" |
9 #include "content/renderer/scheduler/renderer_task_queue_selector.h" | 9 #include "content/renderer/scheduler/renderer_task_queue_selector.h" |
10 #include "ui/gfx/frame_time.h" | 10 #include "ui/gfx/frame_time.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if (now < estimated_next_frame_begin_) { | 86 if (now < estimated_next_frame_begin_) { |
87 StartIdlePeriod(); | 87 StartIdlePeriod(); |
88 control_task_runner_->PostDelayedTask(FROM_HERE, end_idle_period_closure_, | 88 control_task_runner_->PostDelayedTask(FROM_HERE, end_idle_period_closure_, |
89 estimated_next_frame_begin_ - now); | 89 estimated_next_frame_begin_ - now); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread() { | 93 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread() { |
94 // TODO(rmcilroy): Decide whether only a subset of input events should trigger | 94 // TODO(rmcilroy): Decide whether only a subset of input events should trigger |
95 // compositor priority policy - http://crbug.com/429814. | 95 // compositor priority policy - http://crbug.com/429814. |
| 96 UpdateForInputEvent(); |
| 97 } |
| 98 |
| 99 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { |
| 100 UpdateForInputEvent(); |
| 101 } |
| 102 |
| 103 void RendererSchedulerImpl::UpdateForInputEvent() { |
96 base::AutoLock lock(incoming_signals_lock_); | 104 base::AutoLock lock(incoming_signals_lock_); |
97 if (last_input_time_.is_null()) { | 105 if (last_input_time_.is_null()) { |
98 // Update scheduler policy if should start a new compositor policy mode. | 106 // Update scheduler policy if should start a new compositor policy mode. |
99 policy_may_need_update_.SetLocked(true); | 107 policy_may_need_update_.SetLocked(true); |
100 PostUpdatePolicyOnControlRunner(base::TimeDelta()); | 108 PostUpdatePolicyOnControlRunner(base::TimeDelta()); |
101 } | 109 } |
102 last_input_time_ = Now(); | 110 last_input_time_ = Now(); |
103 } | 111 } |
104 | 112 |
105 bool RendererSchedulerImpl::ShouldYieldForHighPriorityWork() { | 113 bool RendererSchedulerImpl::ShouldYieldForHighPriorityWork() { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void RendererSchedulerImpl::PollableNeedsUpdateFlag::SetLocked(bool value) { | 217 void RendererSchedulerImpl::PollableNeedsUpdateFlag::SetLocked(bool value) { |
210 write_lock_->AssertAcquired(); | 218 write_lock_->AssertAcquired(); |
211 base::subtle::Release_Store(&flag_, value); | 219 base::subtle::Release_Store(&flag_, value); |
212 } | 220 } |
213 | 221 |
214 bool RendererSchedulerImpl::PollableNeedsUpdateFlag::IsSet() const { | 222 bool RendererSchedulerImpl::PollableNeedsUpdateFlag::IsSet() const { |
215 thread_checker_.CalledOnValidThread(); | 223 thread_checker_.CalledOnValidThread(); |
216 return base::subtle::Acquire_Load(&flag_) != 0; | 224 return base::subtle::Acquire_Load(&flag_) != 0; |
217 } | 225 } |
218 } // namespace content | 226 } // namespace content |
OLD | NEW |