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