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

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

Issue 2060713002: Respect the order of input messages from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2743
Patch Set: Created 4 years, 6 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_handler_manager.cc
diff --git a/content/renderer/input/input_handler_manager.cc b/content/renderer/input/input_handler_manager.cc
index b6deb4c0b187c2064f916160e10aa46aff04cebb..9803bd9a0e5633de9eb4d2afeba8de7cd771972b 100644
--- a/content/renderer/input/input_handler_manager.cc
+++ b/content/renderer/input/input_handler_manager.cc
@@ -107,7 +107,7 @@ void InputHandlerManager::AddInputHandlerOnCompositorThread(
std::unique_ptr<InputHandlerWrapper> wrapper(new InputHandlerWrapper(
this, routing_id, main_task_runner, input_handler, render_view_impl,
enable_smooth_scrolling, enable_wheel_gestures));
- client_->DidAddInputHandler(routing_id);
+ client_->RegisterRoutingID(routing_id);
if (synchronous_handler_proxy_client_) {
synchronous_handler_proxy_client_->DidAddSynchronousHandlerProxy(
routing_id, wrapper->input_handler_proxy());
@@ -121,7 +121,7 @@ void InputHandlerManager::RemoveInputHandler(int routing_id) {
TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler");
- client_->DidRemoveInputHandler(routing_id);
+ client_->UnregisterRoutingID(routing_id);
if (synchronous_handler_proxy_client_) {
synchronous_handler_proxy_client_->DidRemoveSynchronousHandlerProxy(
routing_id);
@@ -129,6 +129,39 @@ void InputHandlerManager::RemoveInputHandler(int routing_id) {
input_handlers_.erase(routing_id);
}
+void InputHandlerManager::RegisterRoutingID(int routing_id) {
+ if (task_runner_->BelongsToCurrentThread()) {
+ RegisterRoutingIDOnCompositorThread(routing_id);
+ } else {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputHandlerManager::RegisterRoutingIDOnCompositorThread,
+ base::Unretained(this), routing_id));
+ }
+}
+
+void InputHandlerManager::RegisterRoutingIDOnCompositorThread(int routing_id) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ client_->RegisterRoutingID(routing_id);
+}
+
+void InputHandlerManager::UnregisterRoutingID(int routing_id) {
+ if (task_runner_->BelongsToCurrentThread()) {
+ UnregisterRoutingIDOnCompositorThread(routing_id);
+ } else {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputHandlerManager::UnregisterRoutingIDOnCompositorThread,
+ base::Unretained(this), routing_id));
+ }
+}
+
+void InputHandlerManager::UnregisterRoutingIDOnCompositorThread(
+ int routing_id) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ client_->UnregisterRoutingID(routing_id);
+}
+
void InputHandlerManager::ObserveWheelEventAndResultOnMainThread(
int routing_id,
const blink::WebMouseWheelEvent& wheel_event,
« no previous file with comments | « content/renderer/input/input_handler_manager.h ('k') | content/renderer/input/input_handler_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698