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 "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 12 matching lines...) Expand all Loading... | |
23 renderer_task_queue_selector_.get())), | 23 renderer_task_queue_selector_.get())), |
24 control_task_runner_( | 24 control_task_runner_( |
25 task_queue_manager_->TaskRunnerForQueue(CONTROL_TASK_QUEUE)), | 25 task_queue_manager_->TaskRunnerForQueue(CONTROL_TASK_QUEUE)), |
26 default_task_runner_( | 26 default_task_runner_( |
27 task_queue_manager_->TaskRunnerForQueue(DEFAULT_TASK_QUEUE)), | 27 task_queue_manager_->TaskRunnerForQueue(DEFAULT_TASK_QUEUE)), |
28 compositor_task_runner_( | 28 compositor_task_runner_( |
29 task_queue_manager_->TaskRunnerForQueue(COMPOSITOR_TASK_QUEUE)), | 29 task_queue_manager_->TaskRunnerForQueue(COMPOSITOR_TASK_QUEUE)), |
30 loading_task_runner_( | 30 loading_task_runner_( |
31 task_queue_manager_->TaskRunnerForQueue(LOADING_TASK_QUEUE)), | 31 task_queue_manager_->TaskRunnerForQueue(LOADING_TASK_QUEUE)), |
32 current_policy_(NORMAL_PRIORITY_POLICY), | 32 current_policy_(NORMAL_PRIORITY_POLICY), |
33 mouse_down_(false), | |
33 policy_may_need_update_(&incoming_signals_lock_), | 34 policy_may_need_update_(&incoming_signals_lock_), |
34 weak_factory_(this) { | 35 weak_factory_(this) { |
35 weak_renderer_scheduler_ptr_ = weak_factory_.GetWeakPtr(); | 36 weak_renderer_scheduler_ptr_ = weak_factory_.GetWeakPtr(); |
36 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy, | 37 update_policy_closure_ = base::Bind(&RendererSchedulerImpl::UpdatePolicy, |
37 weak_renderer_scheduler_ptr_); | 38 weak_renderer_scheduler_ptr_); |
38 end_idle_period_closure_.Reset(base::Bind( | 39 end_idle_period_closure_.Reset(base::Bind( |
39 &RendererSchedulerImpl::EndIdlePeriod, weak_renderer_scheduler_ptr_)); | 40 &RendererSchedulerImpl::EndIdlePeriod, weak_renderer_scheduler_ptr_)); |
40 idle_task_runner_ = make_scoped_refptr(new SingleThreadIdleTaskRunner( | 41 idle_task_runner_ = make_scoped_refptr(new SingleThreadIdleTaskRunner( |
41 task_queue_manager_->TaskRunnerForQueue(IDLE_TASK_QUEUE), | 42 task_queue_manager_->TaskRunnerForQueue(IDLE_TASK_QUEUE), |
42 base::Bind(&RendererSchedulerImpl::CurrentIdleTaskDeadlineCallback, | 43 base::Bind(&RendererSchedulerImpl::CurrentIdleTaskDeadlineCallback, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 estimated_next_frame_begin_ - now); | 119 estimated_next_frame_begin_ - now); |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread( | 123 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread( |
123 blink::WebInputEvent::Type type) { | 124 blink::WebInputEvent::Type type) { |
124 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 125 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
125 "RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread"); | 126 "RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread"); |
126 // Ignore mouse events because on windows these can very frequent. | 127 // Ignore mouse events because on windows these can very frequent. |
127 // Ignore keyboard events because it doesn't really make sense to enter | 128 // Ignore keyboard events because it doesn't really make sense to enter |
128 // compositor priority for them. | 129 // compositor priority for them. |
rmcilroy
2015/02/05 16:14:59
This comment needs updating (or moved and a new co
alex clarke (OOO till 29th)
2015/02/05 17:47:16
Done.
| |
130 if (type == blink::WebInputEvent::MouseDown) { | |
131 mouse_down_ = true; | |
132 } | |
133 if (type == blink::WebInputEvent::MouseUp) { | |
134 mouse_down_ = false; | |
135 } | |
136 if (type == blink::WebInputEvent::MouseMove && mouse_down_) { | |
Sami
2015/02/05 15:27:28
I think you can just look at the modifiers for the
alex clarke (OOO till 29th)
2015/02/05 17:47:16
Done.
| |
137 UpdateForInputEvent(); | |
138 return; | |
139 } | |
129 if (blink::WebInputEvent::isMouseEventType(type) || | 140 if (blink::WebInputEvent::isMouseEventType(type) || |
130 blink::WebInputEvent::isKeyboardEventType(type)) { | 141 blink::WebInputEvent::isKeyboardEventType(type)) { |
131 return; | 142 return; |
132 } | 143 } |
133 UpdateForInputEvent(); | 144 UpdateForInputEvent(); |
134 } | 145 } |
135 | 146 |
136 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { | 147 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { |
137 UpdateForInputEvent(); | 148 UpdateForInputEvent(); |
138 } | 149 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 state->SetDouble("last_input_time", | 355 state->SetDouble("last_input_time", |
345 (last_input_time_ - base::TimeTicks()).InMillisecondsF()); | 356 (last_input_time_ - base::TimeTicks()).InMillisecondsF()); |
346 state->SetDouble( | 357 state->SetDouble( |
347 "estimated_next_frame_begin", | 358 "estimated_next_frame_begin", |
348 (estimated_next_frame_begin_ - base::TimeTicks()).InMillisecondsF()); | 359 (estimated_next_frame_begin_ - base::TimeTicks()).InMillisecondsF()); |
349 | 360 |
350 return state; | 361 return state; |
351 } | 362 } |
352 | 363 |
353 } // namespace content | 364 } // namespace content |
OLD | NEW |