| Index: content/renderer/input/input_event_filter.cc
|
| diff --git a/content/renderer/input/input_event_filter.cc b/content/renderer/input/input_event_filter.cc
|
| index 927a402b0eecd2c7ca79b4e47e8fdcde453325c6..9a901412f3a8e5a1154c21b9d29891368e49cd05 100644
|
| --- a/content/renderer/input/input_event_filter.cc
|
| +++ b/content/renderer/input/input_event_filter.cc
|
| @@ -65,11 +65,13 @@ void InputEventFilter::DidAddInputHandler(
|
| synchronous_input_handler_proxy) {
|
| base::AutoLock locked(routes_lock_);
|
| routes_.insert(routing_id);
|
| + route_queues_[routing_id].reset(new NonBlockingEventQueue(routing_id, this));
|
| }
|
|
|
| void InputEventFilter::DidRemoveInputHandler(int routing_id) {
|
| base::AutoLock locked(routes_lock_);
|
| routes_.erase(routing_id);
|
| + route_queues_.erase(routing_id);
|
| }
|
|
|
| void InputEventFilter::DidOverscroll(int routing_id,
|
| @@ -87,6 +89,17 @@ void InputEventFilter::DidStopFlinging(int routing_id) {
|
| SendMessage(make_scoped_ptr(new InputHostMsg_DidStopFlinging(routing_id)));
|
| }
|
|
|
| +void InputEventFilter::NonBlockingInputEventHandled(
|
| + int routing_id,
|
| + blink::WebInputEvent::Type type) {
|
| + DCHECK(target_task_runner_->BelongsToCurrentThread());
|
| + RouteQueueMap::iterator iter = route_queues_.find(routing_id);
|
| + if (iter == route_queues_.end() || !iter->second)
|
| + return;
|
| +
|
| + iter->second->EventHandled(type);
|
| +}
|
| +
|
| void InputEventFilter::OnFilterAdded(IPC::Sender* sender) {
|
| io_task_runner_ = base::ThreadTaskRunnerHandle::Get();
|
| sender_ = sender;
|
| @@ -152,9 +165,11 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message) {
|
| return;
|
| const WebInputEvent* event = base::get<0>(params);
|
| ui::LatencyInfo latency_info = base::get<1>(params);
|
| + InputEventDispatchType dispatch_type = base::get<2>(params);
|
| DCHECK(event);
|
| + DCHECK_EQ(DISPATCH_TYPE_NORMAL, dispatch_type);
|
|
|
| - const bool send_ack = WebInputEventTraits::WillReceiveAckFromRenderer(*event);
|
| + bool send_ack = WebInputEventTraits::WillReceiveAckFromRenderer(*event);
|
|
|
| // Intercept |DidOverscroll| notifications, bundling any triggered overscroll
|
| // response with the input event ack.
|
| @@ -165,16 +180,21 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message) {
|
|
|
| InputEventAckState ack_state = handler_.Run(routing_id, event, &latency_info);
|
|
|
| - if (ack_state == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) {
|
| + if (ack_state == INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING) {
|
| + DCHECK(!overscroll_params);
|
| + RouteQueueMap::iterator iter = route_queues_.find(routing_id);
|
| + if (iter != route_queues_.end())
|
| + iter->second->HandleEvent(event, latency_info);
|
| + } else if (ack_state == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) {
|
| DCHECK(!overscroll_params);
|
| TRACE_EVENT_INSTANT0(
|
| - "input",
|
| - "InputEventFilter::ForwardToHandler::ForwardToMainListener",
|
| + "input", "InputEventFilter::ForwardToHandler::ForwardToMainListener",
|
| TRACE_EVENT_SCOPE_THREAD);
|
| IPC::Message new_msg =
|
| - InputMsg_HandleInputEvent(routing_id, event, latency_info);
|
| + InputMsg_HandleInputEvent(routing_id, event, latency_info,
|
| + InputEventDispatchType::DISPATCH_TYPE_NORMAL);
|
| main_task_runner_->PostTask(FROM_HERE, base::Bind(main_listener_, new_msg));
|
| - return;
|
| + send_ack = false;
|
| }
|
|
|
| if (!send_ack)
|
| @@ -204,4 +224,15 @@ void InputEventFilter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) {
|
| sender_->Send(message.release());
|
| }
|
|
|
| +void InputEventFilter::SendNonBlockingEvent(int routing_id,
|
| + const blink::WebInputEvent* event,
|
| + const ui::LatencyInfo& latency) {
|
| + TRACE_EVENT_INSTANT0("input", "InputEventFilter::SendNonBlockingEvent",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + IPC::Message new_msg = InputMsg_HandleInputEvent(
|
| + routing_id, event, latency,
|
| + InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING);
|
| + main_task_runner_->PostTask(FROM_HERE, base::Bind(main_listener_, new_msg));
|
| +}
|
| +
|
| } // namespace content
|
|
|