OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/input/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 void InputRouterImpl::SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, | 152 void InputRouterImpl::SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, |
153 const ui::LatencyInfo& latency_info, | 153 const ui::LatencyInfo& latency_info, |
154 bool is_keyboard_shortcut) { | 154 bool is_keyboard_shortcut) { |
155 // Put all WebKeyboardEvent objects in a queue since we can't trust the | 155 // Put all WebKeyboardEvent objects in a queue since we can't trust the |
156 // renderer and we need to give something to the HandleKeyboardEvent | 156 // renderer and we need to give something to the HandleKeyboardEvent |
157 // handler. | 157 // handler. |
158 key_queue_.push_back(key_event); | 158 key_queue_.push_back(key_event); |
159 LOCAL_HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); | 159 LOCAL_HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); |
160 | 160 |
| 161 gesture_event_queue_.FlingHasBeenHalted(); |
| 162 |
161 // Only forward the non-native portions of our event. | 163 // Only forward the non-native portions of our event. |
162 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); | 164 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); |
163 } | 165 } |
164 | 166 |
165 void InputRouterImpl::SendGestureEvent( | 167 void InputRouterImpl::SendGestureEvent( |
166 const GestureEventWithLatencyInfo& original_gesture_event) { | 168 const GestureEventWithLatencyInfo& original_gesture_event) { |
167 input_stream_validator_.Validate(original_gesture_event.event); | 169 input_stream_validator_.Validate(original_gesture_event.event); |
168 | 170 |
169 GestureEventWithLatencyInfo gesture_event(original_gesture_event); | 171 GestureEventWithLatencyInfo gesture_event(original_gesture_event); |
170 | 172 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 240 } |
239 | 241 |
240 void InputRouterImpl::RequestNotificationWhenFlushed() { | 242 void InputRouterImpl::RequestNotificationWhenFlushed() { |
241 flush_requested_ = true; | 243 flush_requested_ = true; |
242 SignalFlushedIfNecessary(); | 244 SignalFlushedIfNecessary(); |
243 } | 245 } |
244 | 246 |
245 bool InputRouterImpl::HasPendingEvents() const { | 247 bool InputRouterImpl::HasPendingEvents() const { |
246 return !touch_event_queue_.empty() || | 248 return !touch_event_queue_.empty() || |
247 !gesture_event_queue_.empty() || | 249 !gesture_event_queue_.empty() || |
248 gesture_event_queue_.active_fling_count() || | |
249 !key_queue_.empty() || | 250 !key_queue_.empty() || |
250 mouse_move_pending_ || | 251 mouse_move_pending_ || |
251 mouse_wheel_pending_ || | 252 mouse_wheel_pending_ || |
252 select_message_pending_ || | 253 select_message_pending_ || |
253 move_caret_pending_; | 254 move_caret_pending_; |
254 } | 255 } |
255 | 256 |
256 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { | 257 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
257 bool handled = true; | 258 bool handled = true; |
258 IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) | 259 IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 TRACE_EVENT1("input", "InputRouterImpl::OnSetTouchAction", | 490 TRACE_EVENT1("input", "InputRouterImpl::OnSetTouchAction", |
490 "action", touch_action); | 491 "action", touch_action); |
491 | 492 |
492 touch_action_filter_.OnSetTouchAction(touch_action); | 493 touch_action_filter_.OnSetTouchAction(touch_action); |
493 | 494 |
494 // TOUCH_ACTION_NONE should disable the touch ack timeout. | 495 // TOUCH_ACTION_NONE should disable the touch ack timeout. |
495 UpdateTouchAckTimeoutEnabled(); | 496 UpdateTouchAckTimeoutEnabled(); |
496 } | 497 } |
497 | 498 |
498 void InputRouterImpl::OnDidStopFlinging() { | 499 void InputRouterImpl::OnDidStopFlinging() { |
499 gesture_event_queue_.DidStopFlinging(); | 500 // TODO(jdduke): Track fling status to allow flush notifications after a fling |
500 SignalFlushedIfNecessary(); | 501 // has terminated, crbug.com/483037. |
501 client_->DidStopFlinging(); | 502 client_->DidStopFlinging(); |
502 } | 503 } |
503 | 504 |
504 void InputRouterImpl::ProcessInputEventAck( | 505 void InputRouterImpl::ProcessInputEventAck( |
505 WebInputEvent::Type event_type, | 506 WebInputEvent::Type event_type, |
506 InputEventAckState ack_result, | 507 InputEventAckState ack_result, |
507 const ui::LatencyInfo& latency_info, | 508 const ui::LatencyInfo& latency_info, |
508 AckSource ack_source) { | 509 AckSource ack_source) { |
509 TRACE_EVENT2("input", "InputRouterImpl::ProcessInputEventAck", | 510 TRACE_EVENT2("input", "InputRouterImpl::ProcessInputEventAck", |
510 "type", WebInputEventTraits::GetName(event_type), | 511 "type", WebInputEventTraits::GetName(event_type), |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 return; | 637 return; |
637 | 638 |
638 if (HasPendingEvents()) | 639 if (HasPendingEvents()) |
639 return; | 640 return; |
640 | 641 |
641 flush_requested_ = false; | 642 flush_requested_ = false; |
642 client_->DidFlush(); | 643 client_->DidFlush(); |
643 } | 644 } |
644 | 645 |
645 } // namespace content | 646 } // namespace content |
OLD | NEW |