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

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

Issue 2765583002: Teach main thread event queue about closures. (Closed)
Patch Set: Created 3 years, 9 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
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 1cb4efe7ea2e119301d96a7ecc5b513f668d2f05..32259cf4b78cf68724f169db109d4d1931087893 100644
--- a/content/renderer/input/input_event_filter.cc
+++ b/content/renderer/input/input_event_filter.cc
@@ -95,6 +95,15 @@ void InputEventFilter::DidStopFlinging(int routing_id) {
SendMessage(base::MakeUnique<InputHostMsg_DidStopFlinging>(routing_id));
}
+void InputEventFilter::QueueClosureForMainThreadEventQueue(
+ int routing_id,
+ const base::Closure& closure) {
+ DCHECK(target_task_runner_->BelongsToCurrentThread());
+ RouteQueueMap::iterator iter = route_queues_.find(routing_id);
+ if (iter != route_queues_.end())
+ iter->second->QueueClosure(closure);
+}
+
void InputEventFilter::DispatchNonBlockingEventToMainThread(
int routing_id,
ui::WebScopedInputEvent event,
@@ -198,18 +207,17 @@ void InputEventFilter::ForwardToHandler(const IPC::Message& message,
TRACE_EVENT1("input", "InputEventFilter::ForwardToHandler",
"message_type", GetInputMessageTypeName(message));
+ int routing_id = message.routing_id();
if (message.type() != InputMsg_HandleInputEvent::ID) {
TRACE_EVENT_INSTANT0(
"input",
"InputEventFilter::ForwardToHandler::ForwardToMainListener",
TRACE_EVENT_SCOPE_THREAD);
- CHECK(main_task_runner_->PostTask(FROM_HERE,
- base::Bind(main_listener_, message)))
- << "PostTask failed";
+ input_handler_manager_->QueueClosureForMainThreadEventQueue(
+ routing_id, base::Bind(main_listener_, message));
return;
}
- int routing_id = message.routing_id();
InputMsg_HandleInputEvent::Param params;
if (!InputMsg_HandleInputEvent::Read(&message, &params))
return;

Powered by Google App Engine
This is Rietveld 408576698