Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1721)

Unified Diff: content/renderer/input/input_event_filter.cc

Issue 1631963002: Plumb firing passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners_2a
Patch Set: Fix creis's comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/input/input_event_filter.h ('k') | content/renderer/input/input_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/renderer/input/input_event_filter.h ('k') | content/renderer/input/input_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698