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

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

Issue 1877073003: Respect the order of input messages from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add DCHECKs for thread 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 faeb8adc352d80b86f8c1bb6fee2efa2ad6dff5e..5f40b0a1b1b8a129596fca643c12a61a5b367b4a 100644
--- a/content/renderer/input/input_handler_manager.cc
+++ b/content/renderer/input/input_handler_manager.cc
@@ -104,7 +104,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));
- client_->DidAddInputHandler(routing_id);
+ client_->RegisterRoutingID(routing_id);
if (synchronous_handler_proxy_client_) {
synchronous_handler_proxy_client_->DidAddSynchronousHandlerProxy(
routing_id, wrapper->input_handler_proxy());
@@ -118,7 +118,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);
@@ -126,6 +126,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