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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 FROM_HERE, | 127 FROM_HERE, |
128 base::Bind( | 128 base::Bind( |
129 &InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread, | 129 &InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread, |
130 base::Unretained(this), routing_id, wheel_event, scroll_result)); | 130 base::Unretained(this), routing_id, wheel_event, scroll_result)); |
131 } | 131 } |
132 | 132 |
133 void InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread( | 133 void InputHandlerManager::ObserveWheelEventAndResultOnCompositorThread( |
134 int routing_id, | 134 int routing_id, |
135 const blink::WebMouseWheelEvent& wheel_event, | 135 const blink::WebMouseWheelEvent& wheel_event, |
136 const cc::InputHandlerScrollResult& scroll_result) { | 136 const cc::InputHandlerScrollResult& scroll_result) { |
| 137 DCHECK(task_runner_->BelongsToCurrentThread()); |
137 auto it = input_handlers_.find(routing_id); | 138 auto it = input_handlers_.find(routing_id); |
138 if (it == input_handlers_.end()) | 139 if (it == input_handlers_.end()) |
139 return; | 140 return; |
140 | 141 |
141 InputHandlerProxy* proxy = it->second->input_handler_proxy(); | 142 InputHandlerProxy* proxy = it->second->input_handler_proxy(); |
142 DCHECK(proxy->scroll_elasticity_controller()); | 143 DCHECK(proxy->scroll_elasticity_controller()); |
143 proxy->scroll_elasticity_controller()->ObserveWheelEventAndResult( | 144 proxy->scroll_elasticity_controller()->ObserveWheelEventAndResult( |
144 wheel_event, scroll_result); | 145 wheel_event, scroll_result); |
145 } | 146 } |
146 | 147 |
| 148 void InputHandlerManager::ObserveGestureEventAndResultOnMainThread( |
| 149 int routing_id, |
| 150 const blink::WebGestureEvent& gesture_event, |
| 151 const cc::InputHandlerScrollResult& scroll_result) { |
| 152 task_runner_->PostTask( |
| 153 FROM_HERE, |
| 154 base::Bind( |
| 155 &InputHandlerManager::ObserveGestureEventAndResultOnCompositorThread, |
| 156 base::Unretained(this), routing_id, gesture_event, scroll_result)); |
| 157 } |
| 158 |
| 159 void InputHandlerManager::ObserveGestureEventAndResultOnCompositorThread( |
| 160 int routing_id, |
| 161 const blink::WebGestureEvent& gesture_event, |
| 162 const cc::InputHandlerScrollResult& scroll_result) { |
| 163 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 164 auto it = input_handlers_.find(routing_id); |
| 165 if (it == input_handlers_.end()) |
| 166 return; |
| 167 |
| 168 InputHandlerProxy* proxy = it->second->input_handler_proxy(); |
| 169 DCHECK(proxy->scroll_elasticity_controller()); |
| 170 proxy->scroll_elasticity_controller()->ObserveGestureEventAndResult( |
| 171 gesture_event, scroll_result); |
| 172 } |
| 173 |
147 void InputHandlerManager::NonBlockingInputEventHandledOnMainThread( | 174 void InputHandlerManager::NonBlockingInputEventHandledOnMainThread( |
148 int routing_id, | 175 int routing_id, |
149 blink::WebInputEvent::Type type) { | 176 blink::WebInputEvent::Type type) { |
150 task_runner_->PostTask( | 177 task_runner_->PostTask( |
151 FROM_HERE, | 178 FROM_HERE, |
152 base::Bind( | 179 base::Bind( |
153 &InputHandlerManager::NonBlockingInputEventHandledOnCompositorThread, | 180 &InputHandlerManager::NonBlockingInputEventHandledOnCompositorThread, |
154 base::Unretained(this), routing_id, type)); | 181 base::Unretained(this), routing_id, type)); |
155 } | 182 } |
156 | 183 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 237 |
211 void InputHandlerManager::DidStopFlinging(int routing_id) { | 238 void InputHandlerManager::DidStopFlinging(int routing_id) { |
212 client_->DidStopFlinging(routing_id); | 239 client_->DidStopFlinging(routing_id); |
213 } | 240 } |
214 | 241 |
215 void InputHandlerManager::DidAnimateForInput() { | 242 void InputHandlerManager::DidAnimateForInput() { |
216 renderer_scheduler_->DidAnimateForInputOnCompositorThread(); | 243 renderer_scheduler_->DidAnimateForInputOnCompositorThread(); |
217 } | 244 } |
218 | 245 |
219 } // namespace content | 246 } // namespace content |
OLD | NEW |