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..d3d94d89c3a9126504653e4c2e9b95b9b198482f 100644 |
--- a/content/renderer/input/input_event_filter.cc |
+++ b/content/renderer/input/input_event_filter.cc |
@@ -70,6 +70,7 @@ void InputEventFilter::DidAddInputHandler( |
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 +88,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 +164,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 +179,27 @@ 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); |
+ NonBlockingEventQueue* queue = 0; |
+ if (iter != route_queues_.end()) { |
+ queue = iter->second.get(); |
+ } else { |
+ queue = new NonBlockingEventQueue(routing_id, this); |
aelias_OOO_until_Jul13
2016/02/10 03:30:24
Could this object be created in DidAddInputHandler
dtapuska
2016/02/10 16:46:26
Done.
|
+ route_queues_[routing_id].reset(queue); |
+ } |
+ queue->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 +229,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 |