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/immediate_input_router.h" | 5 #include "content/browser/renderer_host/input/immediate_input_router.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/browser/renderer_host/input/gesture_event_filter.h" | 10 #include "content/browser/renderer_host/input/gesture_event_filter.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 OfferToHandlers(mouse_wheel_events[i].event, | 320 OfferToHandlers(mouse_wheel_events[i].event, |
321 mouse_wheel_events[i].latency, | 321 mouse_wheel_events[i].latency, |
322 false); | 322 false); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 // Any input event cancels a pending mouse move event. | 326 // Any input event cancels a pending mouse move event. |
327 next_mouse_move_.reset(); | 327 next_mouse_move_.reset(); |
328 | 328 |
329 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); | 329 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); |
330 // If we don't care about the ack disposition, send the ack immediately. | |
331 if (WebInputEventTraits::IgnoresAckDisposition(input_event.type)) { | |
332 ProcessInputEventAck(input_event.type, | |
333 INPUT_EVENT_ACK_STATE_IGNORED, | |
334 latency_info, | |
335 IGNORING_DISPOSITION); | |
336 } | |
jdduke (slow)
2013/11/05 05:57:18
This code should only be called if the event was s
tdresser
2013/11/05 18:57:02
Done.
| |
330 } | 337 } |
331 | 338 |
332 void ImmediateInputRouter::OfferToHandlers(const WebInputEvent& input_event, | 339 void ImmediateInputRouter::OfferToHandlers(const WebInputEvent& input_event, |
333 const ui::LatencyInfo& latency_info, | 340 const ui::LatencyInfo& latency_info, |
334 bool is_keyboard_shortcut) { | 341 bool is_keyboard_shortcut) { |
335 if (OfferToOverscrollController(input_event, latency_info)) | 342 if (OfferToOverscrollController(input_event, latency_info)) |
336 return; | 343 return; |
337 | 344 |
338 if (OfferToClient(input_event, latency_info)) | 345 if (OfferToClient(input_event, latency_info)) |
339 return; | 346 return; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 void ImmediateInputRouter::OnInputEventAck( | 424 void ImmediateInputRouter::OnInputEventAck( |
418 WebInputEvent::Type event_type, | 425 WebInputEvent::Type event_type, |
419 InputEventAckState ack_result, | 426 InputEventAckState ack_result, |
420 const ui::LatencyInfo& latency_info) { | 427 const ui::LatencyInfo& latency_info) { |
421 // Log the time delta for processing an input event. | 428 // Log the time delta for processing an input event. |
422 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 429 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
423 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); | 430 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); |
424 | 431 |
425 client_->DecrementInFlightEventCount(); | 432 client_->DecrementInFlightEventCount(); |
426 | 433 |
434 // A synthetic ack will already have been sent for this event. | |
435 if (WebInputEventTraits::IgnoresAckDisposition(event_type)) | |
436 return; | |
437 | |
427 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); | 438 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); |
428 // WARNING: |this| may be deleted at this point. | 439 // WARNING: |this| may be deleted at this point. |
429 | 440 |
430 // This is used only for testing, and the other end does not use the | 441 // This is used only for testing, and the other end does not use the |
431 // source object. On linux, specifying | 442 // source object. On linux, specifying |
432 // Source<RenderWidgetHost> results in a very strange | 443 // Source<RenderWidgetHost> results in a very strange |
433 // runtime error in the epilogue of the enclosing | 444 // runtime error in the epilogue of the enclosing |
434 // (ProcessInputEventAck) method, but not on other platforms; using | 445 // (ProcessInputEventAck) method, but not on other platforms; using |
435 // 'void' instead is just as safe (since NotificationSource | 446 // 'void' instead is just as safe (since NotificationSource |
436 // is not actually typesafe) and avoids this error. | 447 // is not actually typesafe) and avoids this error. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 break; | 686 break; |
676 } | 687 } |
677 } | 688 } |
678 | 689 |
679 bool ImmediateInputRouter::IsInOverscrollGesture() const { | 690 bool ImmediateInputRouter::IsInOverscrollGesture() const { |
680 OverscrollController* controller = client_->GetOverscrollController(); | 691 OverscrollController* controller = client_->GetOverscrollController(); |
681 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 692 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
682 } | 693 } |
683 | 694 |
684 } // namespace content | 695 } // namespace content |
OLD | NEW |