| OLD | NEW |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler"); | 122 TRACE_EVENT0("input", "InputHandlerManager::RemoveInputHandler"); |
| 123 | 123 |
| 124 client_->UnregisterRoutingID(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::RegisterAssociatedRenderFrameRoutingID( |
| 133 int render_frame_routing_id, |
| 134 int render_view_routing_id) { |
| 135 if (task_runner_->BelongsToCurrentThread()) { |
| 136 RegisterAssociatedRenderFrameRoutingIDOnCompositorThread( |
| 137 render_frame_routing_id, render_view_routing_id); |
| 138 } else { |
| 139 task_runner_->PostTask( |
| 140 FROM_HERE, |
| 141 base::Bind(&InputHandlerManager:: |
| 142 RegisterAssociatedRenderFrameRoutingIDOnCompositorThread, |
| 143 base::Unretained(this), render_frame_routing_id, |
| 144 render_view_routing_id)); |
| 145 } |
| 146 } |
| 147 |
| 148 void InputHandlerManager:: |
| 149 RegisterAssociatedRenderFrameRoutingIDOnCompositorThread( |
| 150 int render_frame_routing_id, |
| 151 int render_view_routing_id) { |
| 152 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 153 client_->RegisterAssociatedRenderFrameRoutingID(render_frame_routing_id, |
| 154 render_view_routing_id); |
| 155 } |
| 156 |
| 132 void InputHandlerManager::RegisterRoutingID(int routing_id) { | 157 void InputHandlerManager::RegisterRoutingID(int routing_id) { |
| 133 if (task_runner_->BelongsToCurrentThread()) { | 158 if (task_runner_->BelongsToCurrentThread()) { |
| 134 RegisterRoutingIDOnCompositorThread(routing_id); | 159 RegisterRoutingIDOnCompositorThread(routing_id); |
| 135 } else { | 160 } else { |
| 136 task_runner_->PostTask( | 161 task_runner_->PostTask( |
| 137 FROM_HERE, | 162 FROM_HERE, |
| 138 base::Bind(&InputHandlerManager::RegisterRoutingIDOnCompositorThread, | 163 base::Bind(&InputHandlerManager::RegisterRoutingIDOnCompositorThread, |
| 139 base::Unretained(this), routing_id)); | 164 base::Unretained(this), routing_id)); |
| 140 } | 165 } |
| 141 } | 166 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 248 |
| 224 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent", | 249 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent", |
| 225 "result", "EventSentToInputHandlerProxy"); | 250 "result", "EventSentToInputHandlerProxy"); |
| 226 InputHandlerProxy* proxy = it->second->input_handler_proxy(); | 251 InputHandlerProxy* proxy = it->second->input_handler_proxy(); |
| 227 proxy->HandleInputEventWithLatencyInfo( | 252 proxy->HandleInputEventWithLatencyInfo( |
| 228 std::move(input_event), latency_info, | 253 std::move(input_event), latency_info, |
| 229 base::Bind(&InputHandlerManager::DidHandleInputEventAndOverscroll, | 254 base::Bind(&InputHandlerManager::DidHandleInputEventAndOverscroll, |
| 230 weak_ptr_factory_.GetWeakPtr(), callback)); | 255 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 231 } | 256 } |
| 232 | 257 |
| 258 void InputHandlerManager::QueueClosureForMainThreadEventQueue( |
| 259 int routing_id, |
| 260 const base::Closure& closure) { |
| 261 client_->QueueClosureForMainThreadEventQueue(routing_id, closure); |
| 262 } |
| 263 |
| 233 void InputHandlerManager::DidHandleInputEventAndOverscroll( | 264 void InputHandlerManager::DidHandleInputEventAndOverscroll( |
| 234 const InputEventAckStateCallback& callback, | 265 const InputEventAckStateCallback& callback, |
| 235 InputHandlerProxy::EventDisposition event_disposition, | 266 InputHandlerProxy::EventDisposition event_disposition, |
| 236 ui::WebScopedInputEvent input_event, | 267 ui::WebScopedInputEvent input_event, |
| 237 const ui::LatencyInfo& latency_info, | 268 const ui::LatencyInfo& latency_info, |
| 238 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { | 269 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { |
| 239 InputEventAckState input_event_ack_state = | 270 InputEventAckState input_event_ack_state = |
| 240 InputEventDispositionToAck(event_disposition); | 271 InputEventDispositionToAck(event_disposition); |
| 241 switch (input_event_ack_state) { | 272 switch (input_event_ack_state) { |
| 242 case INPUT_EVENT_ACK_STATE_CONSUMED: | 273 case INPUT_EVENT_ACK_STATE_CONSUMED: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void InputHandlerManager::DispatchNonBlockingEventToMainThread( | 312 void InputHandlerManager::DispatchNonBlockingEventToMainThread( |
| 282 int routing_id, | 313 int routing_id, |
| 283 ui::WebScopedInputEvent event, | 314 ui::WebScopedInputEvent event, |
| 284 const ui::LatencyInfo& latency_info) { | 315 const ui::LatencyInfo& latency_info) { |
| 285 DCHECK(task_runner_->BelongsToCurrentThread()); | 316 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 286 client_->DispatchNonBlockingEventToMainThread(routing_id, std::move(event), | 317 client_->DispatchNonBlockingEventToMainThread(routing_id, std::move(event), |
| 287 latency_info); | 318 latency_info); |
| 288 } | 319 } |
| 289 | 320 |
| 290 } // namespace content | 321 } // namespace content |
| OLD | NEW |