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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 if (input_event.type != WebInputEvent::MouseWheel) { | 333 if (input_event.type != WebInputEvent::MouseWheel) { |
334 for (size_t i = 0; i < coalesced_mouse_wheel_events_.size(); ++i) { | 334 for (size_t i = 0; i < coalesced_mouse_wheel_events_.size(); ++i) { |
335 SendWebInputEvent(coalesced_mouse_wheel_events_[i].event, | 335 SendWebInputEvent(coalesced_mouse_wheel_events_[i].event, |
336 coalesced_mouse_wheel_events_[i].latency, | 336 coalesced_mouse_wheel_events_[i].latency, |
337 false); | 337 false); |
338 } | 338 } |
339 coalesced_mouse_wheel_events_.clear(); | 339 coalesced_mouse_wheel_events_.clear(); |
340 } | 340 } |
341 | 341 |
342 SendWebInputEvent(input_event, latency_info, is_keyboard_shortcut); | 342 SendWebInputEvent(input_event, latency_info, is_keyboard_shortcut); |
343 // If we don't care about the ack disposition, send the ack immediately. | |
344 if (WebInputEventTraits::IgnoresAckDisposition(input_event.type)) { | |
345 ProcessInputEventAck(input_event.type, | |
346 INPUT_EVENT_ACK_STATE_IGNORED, | |
347 latency_info, | |
348 CLIENT); | |
jdduke (slow)
2013/10/25 20:53:34
Please create a new enum entry for this ack source
tdresser
2013/11/04 15:57:30
Done.
| |
349 } | |
343 | 350 |
344 // Any input event cancels a pending mouse move event. | 351 // Any input event cancels a pending mouse move event. |
345 next_mouse_move_.reset(); | 352 next_mouse_move_.reset(); |
346 } | 353 } |
347 | 354 |
348 bool ImmediateInputRouter::OfferToOverscrollController( | 355 bool ImmediateInputRouter::OfferToOverscrollController( |
349 const WebInputEvent& input_event, | 356 const WebInputEvent& input_event, |
350 const ui::LatencyInfo& latency_info) { | 357 const ui::LatencyInfo& latency_info) { |
351 OverscrollController* controller = client_->GetOverscrollController(); | 358 OverscrollController* controller = client_->GetOverscrollController(); |
352 if (!controller) | 359 if (!controller) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 void ImmediateInputRouter::OnInputEventAck( | 416 void ImmediateInputRouter::OnInputEventAck( |
410 WebInputEvent::Type event_type, | 417 WebInputEvent::Type event_type, |
411 InputEventAckState ack_result, | 418 InputEventAckState ack_result, |
412 const ui::LatencyInfo& latency_info) { | 419 const ui::LatencyInfo& latency_info) { |
413 // Log the time delta for processing an input event. | 420 // Log the time delta for processing an input event. |
414 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 421 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
415 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); | 422 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); |
416 | 423 |
417 client_->DecrementInFlightEventCount(); | 424 client_->DecrementInFlightEventCount(); |
418 | 425 |
426 // A synthetic ack will already have been sent for this event. | |
427 if (WebInputEventTraits::IgnoresAckDisposition(event_type)) | |
428 return; | |
429 | |
419 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); | 430 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); |
420 // WARNING: |this| may be deleted at this point. | 431 // WARNING: |this| may be deleted at this point. |
421 | 432 |
422 // This is used only for testing, and the other end does not use the | 433 // This is used only for testing, and the other end does not use the |
423 // source object. On linux, specifying | 434 // source object. On linux, specifying |
424 // Source<RenderWidgetHost> results in a very strange | 435 // Source<RenderWidgetHost> results in a very strange |
425 // runtime error in the epilogue of the enclosing | 436 // runtime error in the epilogue of the enclosing |
426 // (ProcessInputEventAck) method, but not on other platforms; using | 437 // (ProcessInputEventAck) method, but not on other platforms; using |
427 // 'void' instead is just as safe (since NotificationSource | 438 // 'void' instead is just as safe (since NotificationSource |
428 // is not actually typesafe) and avoids this error. | 439 // is not actually typesafe) and avoids this error. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
667 break; | 678 break; |
668 } | 679 } |
669 } | 680 } |
670 | 681 |
671 bool ImmediateInputRouter::IsInOverscrollGesture() const { | 682 bool ImmediateInputRouter::IsInOverscrollGesture() const { |
672 OverscrollController* controller = client_->GetOverscrollController(); | 683 OverscrollController* controller = client_->GetOverscrollController(); |
673 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 684 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
674 } | 685 } |
675 | 686 |
676 } // namespace content | 687 } // namespace content |
OLD | NEW |