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

Side by Side 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: moved DCHECK inside if scope 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/input_handler_manager.h" 5 #include "content/renderer/input/input_handler_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // The same handler may be registered for a route multiple times. 100 // The same handler may be registered for a route multiple times.
101 if (input_handlers_.count(routing_id) != 0) 101 if (input_handlers_.count(routing_id) != 0)
102 return; 102 return;
103 103
104 TRACE_EVENT1("input", 104 TRACE_EVENT1("input",
105 "InputHandlerManager::AddInputHandlerOnCompositorThread", 105 "InputHandlerManager::AddInputHandlerOnCompositorThread",
106 "result", "AddingRoute"); 106 "result", "AddingRoute");
107 std::unique_ptr<InputHandlerWrapper> wrapper(new InputHandlerWrapper( 107 std::unique_ptr<InputHandlerWrapper> wrapper(new InputHandlerWrapper(
108 this, routing_id, main_task_runner, input_handler, render_view_impl, 108 this, routing_id, main_task_runner, input_handler, render_view_impl,
109 enable_smooth_scrolling, enable_wheel_gestures)); 109 enable_smooth_scrolling, enable_wheel_gestures));
110 client_->DidAddInputHandler(routing_id); 110 client_->RegisterRoutingID(routing_id);
111 if (synchronous_handler_proxy_client_) { 111 if (synchronous_handler_proxy_client_) {
112 synchronous_handler_proxy_client_->DidAddSynchronousHandlerProxy( 112 synchronous_handler_proxy_client_->DidAddSynchronousHandlerProxy(
113 routing_id, wrapper->input_handler_proxy()); 113 routing_id, wrapper->input_handler_proxy());
114 } 114 }
115 input_handlers_.add(routing_id, std::move(wrapper)); 115 input_handlers_.add(routing_id, std::move(wrapper));
116 } 116 }
117 117
118 void InputHandlerManager::RemoveInputHandler(int routing_id) { 118 void InputHandlerManager::RemoveInputHandler(int routing_id) {
119 DCHECK(task_runner_->BelongsToCurrentThread()); 119 DCHECK(task_runner_->BelongsToCurrentThread());
120 DCHECK(input_handlers_.contains(routing_id)); 120 DCHECK(input_handlers_.contains(routing_id));
121 121
122 TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler"); 122 TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler");
123 123
124 client_->DidRemoveInputHandler(routing_id); 124 client_->UnregisterRoutingID(routing_id);
125 if (synchronous_handler_proxy_client_) { 125 if (synchronous_handler_proxy_client_) {
126 synchronous_handler_proxy_client_->DidRemoveSynchronousHandlerProxy( 126 synchronous_handler_proxy_client_->DidRemoveSynchronousHandlerProxy(
127 routing_id); 127 routing_id);
128 } 128 }
129 input_handlers_.erase(routing_id); 129 input_handlers_.erase(routing_id);
130 } 130 }
131 131
132 void InputHandlerManager::RegisterRoutingID(int routing_id) {
133 if (task_runner_->BelongsToCurrentThread()) {
134 RegisterRoutingIDOnCompositorThread(routing_id);
135 } else {
136 task_runner_->PostTask(
137 FROM_HERE,
138 base::Bind(&InputHandlerManager::RegisterRoutingIDOnCompositorThread,
139 base::Unretained(this), routing_id));
140 }
141 }
142
143 void InputHandlerManager::RegisterRoutingIDOnCompositorThread(int routing_id) {
no sievers 2016/06/10 19:58:30 nit: DCHECK(task_runner_->BelongsToCurrentThread(
Changwan Ryu 2016/06/13 01:20:59 Done.
144 client_->RegisterRoutingID(routing_id);
145 }
146
147 void InputHandlerManager::UnregisterRoutingID(int routing_id) {
148 if (task_runner_->BelongsToCurrentThread()) {
149 UnregisterRoutingIDOnCompositorThread(routing_id);
150 } else {
151 task_runner_->PostTask(
152 FROM_HERE,
153 base::Bind(&InputHandlerManager::UnregisterRoutingIDOnCompositorThread,
154 base::Unretained(this), routing_id));
155 }
156 }
157
158 void InputHandlerManager::UnregisterRoutingIDOnCompositorThread(
159 int routing_id) {
160 client_->UnregisterRoutingID(routing_id);
no sievers 2016/06/10 19:58:30 nit: DCHECK(task_runner_->BelongsToCurrentThread(
Changwan Ryu 2016/06/13 01:20:59 Done.
161 }
162
132 void InputHandlerManager::ObserveWheelEventAndResultOnMainThread( 163 void InputHandlerManager::ObserveWheelEventAndResultOnMainThread(
133 int routing_id, 164 int routing_id,
134 const blink::WebMouseWheelEvent& wheel_event, 165 const blink::WebMouseWheelEvent& wheel_event,
135 const cc::InputHandlerScrollResult& scroll_result) { 166 const cc::InputHandlerScrollResult& scroll_result) {
136 task_runner_->PostTask( 167 task_runner_->PostTask(
137 FROM_HERE, 168 FROM_HERE,
138 base::Bind( 169 base::Bind(
139 &InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread, 170 &InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread,
140 base::Unretained(this), routing_id, wheel_event, scroll_result)); 171 base::Unretained(this), routing_id, wheel_event, scroll_result));
141 } 172 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 282
252 void InputHandlerManager::DidStopFlinging(int routing_id) { 283 void InputHandlerManager::DidStopFlinging(int routing_id) {
253 client_->DidStopFlinging(routing_id); 284 client_->DidStopFlinging(routing_id);
254 } 285 }
255 286
256 void InputHandlerManager::DidAnimateForInput() { 287 void InputHandlerManager::DidAnimateForInput() {
257 renderer_scheduler_->DidAnimateForInputOnCompositorThread(); 288 renderer_scheduler_->DidAnimateForInputOnCompositorThread();
258 } 289 }
259 290
260 } // namespace content 291 } // namespace content
OLDNEW
« 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