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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 void ImmediateInputRouter::OfferToHandlers(const WebInputEvent& input_event, | 332 void ImmediateInputRouter::OfferToHandlers(const WebInputEvent& input_event, |
333 const ui::LatencyInfo& latency_info, | 333 const ui::LatencyInfo& latency_info, |
334 bool is_keyboard_shortcut) { | 334 bool is_keyboard_shortcut) { |
335 if (OfferToOverscrollController(input_event, latency_info)) | 335 if (OfferToOverscrollController(input_event, latency_info)) |
336 return; | 336 return; |
337 | 337 |
338 if (OfferToClient(input_event, latency_info)) | 338 if (OfferToClient(input_event, latency_info)) |
339 return; | 339 return; |
340 | 340 |
341 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); | 341 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); |
| 342 |
| 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 IGNORING_DISPOSITION); |
| 349 } |
342 } | 350 } |
343 | 351 |
344 bool ImmediateInputRouter::OfferToOverscrollController( | 352 bool ImmediateInputRouter::OfferToOverscrollController( |
345 const WebInputEvent& input_event, | 353 const WebInputEvent& input_event, |
346 const ui::LatencyInfo& latency_info) { | 354 const ui::LatencyInfo& latency_info) { |
347 OverscrollController* controller = client_->GetOverscrollController(); | 355 OverscrollController* controller = client_->GetOverscrollController(); |
348 if (!controller) | 356 if (!controller) |
349 return false; | 357 return false; |
350 | 358 |
351 OverscrollController::Disposition disposition = | 359 OverscrollController::Disposition disposition = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 void ImmediateInputRouter::OnInputEventAck( | 425 void ImmediateInputRouter::OnInputEventAck( |
418 WebInputEvent::Type event_type, | 426 WebInputEvent::Type event_type, |
419 InputEventAckState ack_result, | 427 InputEventAckState ack_result, |
420 const ui::LatencyInfo& latency_info) { | 428 const ui::LatencyInfo& latency_info) { |
421 // Log the time delta for processing an input event. | 429 // Log the time delta for processing an input event. |
422 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 430 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
423 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); | 431 UMA_HISTOGRAM_TIMES("MPArch.IIR_InputEventDelta", delta); |
424 | 432 |
425 client_->DecrementInFlightEventCount(); | 433 client_->DecrementInFlightEventCount(); |
426 | 434 |
| 435 // A synthetic ack will already have been sent for this event. |
| 436 if (WebInputEventTraits::IgnoresAckDisposition(event_type)) |
| 437 return; |
| 438 |
427 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); | 439 ProcessInputEventAck(event_type, ack_result, latency_info, RENDERER); |
428 // WARNING: |this| may be deleted at this point. | 440 // WARNING: |this| may be deleted at this point. |
429 | 441 |
430 // This is used only for testing, and the other end does not use the | 442 // This is used only for testing, and the other end does not use the |
431 // source object. On linux, specifying | 443 // source object. On linux, specifying |
432 // Source<RenderWidgetHost> results in a very strange | 444 // Source<RenderWidgetHost> results in a very strange |
433 // runtime error in the epilogue of the enclosing | 445 // runtime error in the epilogue of the enclosing |
434 // (ProcessInputEventAck) method, but not on other platforms; using | 446 // (ProcessInputEventAck) method, but not on other platforms; using |
435 // 'void' instead is just as safe (since NotificationSource | 447 // 'void' instead is just as safe (since NotificationSource |
436 // is not actually typesafe) and avoids this error. | 448 // is not actually typesafe) and avoids this error. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 break; | 687 break; |
676 } | 688 } |
677 } | 689 } |
678 | 690 |
679 bool ImmediateInputRouter::IsInOverscrollGesture() const { | 691 bool ImmediateInputRouter::IsInOverscrollGesture() const { |
680 OverscrollController* controller = client_->GetOverscrollController(); | 692 OverscrollController* controller = client_->GetOverscrollController(); |
681 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; | 693 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; |
682 } | 694 } |
683 | 695 |
684 } // namespace content | 696 } // namespace content |
OLD | NEW |