| Index: content/browser/renderer_host/input/input_router_impl.cc
|
| diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc
|
| index 32f3d89b82f5a57fbdf1271154922bafbbe4668f..b707f8f52fce53064a5d719d0556b5c260c9d7d3 100644
|
| --- a/content/browser/renderer_host/input/input_router_impl.cc
|
| +++ b/content/browser/renderer_host/input/input_router_impl.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/auto_reset.h"
|
| #include "base/command_line.h"
|
| #include "base/metrics/histogram.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "content/browser/renderer_host/input/gesture_event_filter.h"
|
| #include "content/browser/renderer_host/input/input_ack_handler.h"
|
| #include "content/browser/renderer_host/input/input_router_client.h"
|
| @@ -39,6 +40,21 @@ using blink::WebMouseWheelEvent;
|
| namespace content {
|
| namespace {
|
|
|
| +bool GetTouchAckTimeoutDelayMs(size_t* touch_ack_timeout_delay_ms) {
|
| + CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
|
| + if (!parsed_command_line->HasSwitch(switches::kTouchAckTimeoutDelayMs))
|
| + return false;
|
| +
|
| + std::string timeout_string = parsed_command_line->GetSwitchValueASCII(
|
| + switches::kTouchAckTimeoutDelayMs);
|
| + size_t timeout_value;
|
| + if (!base::StringToSizeT(timeout_string, &timeout_value))
|
| + return false;
|
| +
|
| + *touch_ack_timeout_delay_ms = timeout_value;
|
| + return true;
|
| +}
|
| +
|
| GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type,
|
| double timestamp_seconds,
|
| int x,
|
| @@ -85,12 +101,18 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender,
|
| mouse_move_pending_(false),
|
| mouse_wheel_pending_(false),
|
| has_touch_handler_(false),
|
| + touch_ack_timeout_enabled_(false),
|
| + touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()),
|
| current_ack_source_(ACK_SOURCE_NONE),
|
| - touch_event_queue_(new TouchEventQueue(this)),
|
| gesture_event_filter_(new GestureEventFilter(this, this)) {
|
| DCHECK(sender);
|
| DCHECK(client);
|
| DCHECK(ack_handler);
|
| + touch_event_queue_.reset(new TouchEventQueue(this));
|
| + touch_ack_timeout_enabled_ =
|
| + GetTouchAckTimeoutDelayMs(&touch_ack_timeout_delay_ms_);
|
| + touch_event_queue_->SetAckTimeoutEnabled(touch_ack_timeout_enabled_,
|
| + touch_ack_timeout_delay_ms_);
|
| }
|
|
|
| InputRouterImpl::~InputRouterImpl() {}
|
| @@ -176,7 +198,7 @@ void InputRouterImpl::SendKeyboardEvent(const NativeWebKeyboardEvent& key_event,
|
|
|
| void InputRouterImpl::SendGestureEvent(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| - HandleGestureScroll(gesture_event);
|
| + touch_event_queue_->OnGestureScrollEvent(gesture_event);
|
|
|
| if (!IsInOverscrollGesture() &&
|
| !gesture_event_filter_->ShouldForward(gesture_event)) {
|
| @@ -223,7 +245,6 @@ void InputRouterImpl::SendTouchEventImmediately(
|
|
|
| void InputRouterImpl::SendGestureEventImmediately(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| - HandleGestureScroll(gesture_event);
|
| FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false);
|
| }
|
|
|
| @@ -241,6 +262,14 @@ bool InputRouterImpl::ShouldForwardTouchEvent() const {
|
| return has_touch_handler_ || !touch_event_queue_->empty();
|
| }
|
|
|
| +void InputRouterImpl::OnViewUpdated(int view_flags) OVERRIDE {
|
| + bool fixed_page_scale = (view_flags & FIXED_PAGE_SCALE);
|
| + bool mobile_viewport = (view_flags & MOBILE_VIEWPORT);
|
| + touch_event_queue_->SetAckTimeoutEnabled(
|
| + touch_ack_timeout_enabled_ && !(fixed_page_scale || mobile_viewport),
|
| + touch_ack_timeout_delay_ms_);
|
| +}
|
| +
|
| bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| bool message_is_ok = true;
|
| @@ -596,11 +625,6 @@ void InputRouterImpl::ProcessAckForOverscroll(const WebInputEvent& event,
|
| event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result));
|
| }
|
|
|
| -void InputRouterImpl::HandleGestureScroll(
|
| - const GestureEventWithLatencyInfo& gesture_event) {
|
| - touch_event_queue_->OnGestureScrollEvent(gesture_event);
|
| -}
|
| -
|
| void InputRouterImpl::SimulateTouchGestureWithMouse(
|
| const MouseEventWithLatencyInfo& event) {
|
| const WebMouseEvent& mouse_event = event.event;
|
|
|