Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 2884953002: Fix Mouse Event Tracing (requires making some events blocking.) (Closed)
Patch Set: Disable test on Android, as mouse input isn't supported. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 9 #include <utility>
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 TouchEventWithLatencyInfo updatd_touch_event = touch_event; 198 TouchEventWithLatencyInfo updatd_touch_event = touch_event;
199 SetMovementXYForTouchPoints(&updatd_touch_event.event); 199 SetMovementXYForTouchPoints(&updatd_touch_event.event);
200 input_stream_validator_.Validate(updatd_touch_event.event); 200 input_stream_validator_.Validate(updatd_touch_event.event);
201 touch_event_queue_->QueueEvent(updatd_touch_event); 201 touch_event_queue_->QueueEvent(updatd_touch_event);
202 } 202 }
203 203
204 // Forwards MouseEvent without passing it through 204 // Forwards MouseEvent without passing it through
205 // TouchpadTapSuppressionController. 205 // TouchpadTapSuppressionController.
206 void InputRouterImpl::SendMouseEventImmediately( 206 void InputRouterImpl::SendMouseEventImmediately(
207 const MouseEventWithLatencyInfo& mouse_event) { 207 const MouseEventWithLatencyInfo& mouse_event) {
208 if (mouse_event.event.GetType() == blink::WebInputEvent::kMouseMove) 208 mouse_event_queue_.push_back(mouse_event);
209 mouse_move_queue_.push_back(mouse_event);
210
211 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency); 209 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency);
212 } 210 }
213 211
214 void InputRouterImpl::SendTouchEventImmediately( 212 void InputRouterImpl::SendTouchEventImmediately(
215 const TouchEventWithLatencyInfo& touch_event) { 213 const TouchEventWithLatencyInfo& touch_event) {
216 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency); 214 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency);
217 } 215 }
218 216
219 void InputRouterImpl::SendGestureEventImmediately( 217 void InputRouterImpl::SendGestureEventImmediately(
220 const GestureEventWithLatencyInfo& gesture_event) { 218 const GestureEventWithLatencyInfo& gesture_event) {
(...skipping 10 matching lines...) Expand all
231 touch_event_queue_->SetIsMobileOptimizedSite(is_mobile_optimized); 229 touch_event_queue_->SetIsMobileOptimizedSite(is_mobile_optimized);
232 } 230 }
233 231
234 void InputRouterImpl::RequestNotificationWhenFlushed() { 232 void InputRouterImpl::RequestNotificationWhenFlushed() {
235 flush_requested_ = true; 233 flush_requested_ = true;
236 SignalFlushedIfNecessary(); 234 SignalFlushedIfNecessary();
237 } 235 }
238 236
239 bool InputRouterImpl::HasPendingEvents() const { 237 bool InputRouterImpl::HasPendingEvents() const {
240 return !touch_event_queue_->Empty() || !gesture_event_queue_.empty() || 238 return !touch_event_queue_->Empty() || !gesture_event_queue_.empty() ||
241 !key_queue_.empty() || !mouse_move_queue_.empty() || 239 !key_queue_.empty() || !mouse_event_queue_.empty() ||
242 wheel_event_queue_.has_pending() || select_message_pending_ || 240 wheel_event_queue_.has_pending() || select_message_pending_ ||
243 move_caret_pending_ || active_renderer_fling_count_ > 0; 241 move_caret_pending_ || active_renderer_fling_count_ > 0;
244 } 242 }
245 243
246 void InputRouterImpl::SetDeviceScaleFactor(float device_scale_factor) { 244 void InputRouterImpl::SetDeviceScaleFactor(float device_scale_factor) {
247 device_scale_factor_ = device_scale_factor; 245 device_scale_factor_ = device_scale_factor;
248 } 246 }
249 247
250 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { 248 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
251 bool handled = true; 249 bool handled = true;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // WARNING: This InputRouterImpl can be deallocated at this point 576 // WARNING: This InputRouterImpl can be deallocated at this point
579 // (i.e. in the case of Ctrl+W, where the call to 577 // (i.e. in the case of Ctrl+W, where the call to
580 // HandleKeyboardEvent destroys this InputRouterImpl). 578 // HandleKeyboardEvent destroys this InputRouterImpl).
581 // TODO(jdduke): crbug.com/274029 - Make ack-triggered shutdown async. 579 // TODO(jdduke): crbug.com/274029 - Make ack-triggered shutdown async.
582 } 580 }
583 } 581 }
584 582
585 void InputRouterImpl::ProcessMouseAck(blink::WebInputEvent::Type type, 583 void InputRouterImpl::ProcessMouseAck(blink::WebInputEvent::Type type,
586 InputEventAckState ack_result, 584 InputEventAckState ack_result,
587 const ui::LatencyInfo& latency) { 585 const ui::LatencyInfo& latency) {
588 if (type != WebInputEvent::kMouseMove) 586 if (mouse_event_queue_.empty()) {
589 return;
590
591 if (mouse_move_queue_.empty()) {
592 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_ACK); 587 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_ACK);
593 } else { 588 } else {
594 MouseEventWithLatencyInfo front_item = mouse_move_queue_.front(); 589 MouseEventWithLatencyInfo front_item = mouse_event_queue_.front();
595 front_item.latency.AddNewLatencyFrom(latency); 590 front_item.latency.AddNewLatencyFrom(latency);
596 mouse_move_queue_.pop_front(); 591 mouse_event_queue_.pop_front();
597 ack_handler_->OnMouseEventAck(front_item, ack_result); 592 ack_handler_->OnMouseEventAck(front_item, ack_result);
598 } 593 }
599 } 594 }
600 595
601 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result, 596 void InputRouterImpl::ProcessWheelAck(InputEventAckState ack_result,
602 const ui::LatencyInfo& latency) { 597 const ui::LatencyInfo& latency) {
603 wheel_event_queue_.ProcessMouseWheelAck(ack_result, latency); 598 wheel_event_queue_.ProcessMouseWheelAck(ack_result, latency);
604 } 599 }
605 600
606 void InputRouterImpl::ProcessGestureAck(WebInputEvent::Type type, 601 void InputRouterImpl::ProcessGestureAck(WebInputEvent::Type type,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 DCHECK(global_touch_position_.find(touch_point->id) == 663 DCHECK(global_touch_position_.find(touch_point->id) ==
669 global_touch_position_.end()); 664 global_touch_position_.end());
670 global_touch_position_[touch_point->id] = gfx::Point( 665 global_touch_position_[touch_point->id] = gfx::Point(
671 touch_point->screen_position.x, touch_point->screen_position.y); 666 touch_point->screen_position.x, touch_point->screen_position.y);
672 } 667 }
673 } 668 }
674 } 669 }
675 } 670 }
676 671
677 } // namespace content 672 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698