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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return; | 83 return; |
84 | 84 |
85 base::TimeTicks now(Now()); | 85 base::TimeTicks now(Now()); |
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 blink::WebInputEvent::Type type) { |
95 // compositor priority policy - http://crbug.com/429814. | 95 // Ignore mouse events because on windows these can very frequent. |
| 96 // Ignore keyboard events because it doesn't really make sense to enter |
| 97 // compositor priority for them. |
| 98 if (blink::WebInputEvent::isMouseEventType(type) || |
| 99 blink::WebInputEvent::isKeyboardEventType(type)) { |
| 100 return; |
| 101 } |
| 102 UpdateForInputEvent(); |
| 103 } |
| 104 |
| 105 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { |
| 106 UpdateForInputEvent(); |
| 107 } |
| 108 |
| 109 void RendererSchedulerImpl::UpdateForInputEvent() { |
96 base::AutoLock lock(incoming_signals_lock_); | 110 base::AutoLock lock(incoming_signals_lock_); |
97 if (last_input_time_.is_null()) { | 111 if (last_input_time_.is_null()) { |
98 // Update scheduler policy if should start a new compositor policy mode. | 112 // Update scheduler policy if should start a new compositor policy mode. |
99 policy_may_need_update_.SetLocked(true); | 113 policy_may_need_update_.SetLocked(true); |
100 PostUpdatePolicyOnControlRunner(base::TimeDelta()); | 114 PostUpdatePolicyOnControlRunner(base::TimeDelta()); |
101 } | 115 } |
102 last_input_time_ = Now(); | 116 last_input_time_ = Now(); |
103 } | 117 } |
104 | 118 |
105 bool RendererSchedulerImpl::ShouldYieldForHighPriorityWork() { | 119 bool RendererSchedulerImpl::ShouldYieldForHighPriorityWork() { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void RendererSchedulerImpl::PollableNeedsUpdateFlag::SetLocked(bool value) { | 223 void RendererSchedulerImpl::PollableNeedsUpdateFlag::SetLocked(bool value) { |
210 write_lock_->AssertAcquired(); | 224 write_lock_->AssertAcquired(); |
211 base::subtle::Release_Store(&flag_, value); | 225 base::subtle::Release_Store(&flag_, value); |
212 } | 226 } |
213 | 227 |
214 bool RendererSchedulerImpl::PollableNeedsUpdateFlag::IsSet() const { | 228 bool RendererSchedulerImpl::PollableNeedsUpdateFlag::IsSet() const { |
215 thread_checker_.CalledOnValidThread(); | 229 thread_checker_.CalledOnValidThread(); |
216 return base::subtle::Acquire_Load(&flag_) != 0; | 230 return base::subtle::Acquire_Load(&flag_) != 0; |
217 } | 231 } |
218 } // namespace content | 232 } // namespace content |
OLD | NEW |