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

Side by Side Diff: content/renderer/input/input_handler_manager.cc

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Creating CoalescedWebInputEvent Created 4 years, 1 month 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 InputEventAckState ack_result) { 194 InputEventAckState ack_result) {
195 client_->NotifyInputEventHandled(routing_id, type, ack_result); 195 client_->NotifyInputEventHandled(routing_id, type, ack_result);
196 } 196 }
197 197
198 void InputHandlerManager::ProcessRafAlignedInputOnMainThread(int routing_id) { 198 void InputHandlerManager::ProcessRafAlignedInputOnMainThread(int routing_id) {
199 client_->ProcessRafAlignedInput(routing_id); 199 client_->ProcessRafAlignedInput(routing_id);
200 } 200 }
201 201
202 void InputHandlerManager::HandleInputEvent( 202 void InputHandlerManager::HandleInputEvent(
203 int routing_id, 203 int routing_id,
204 ui::ScopedWebInputEvent input_event, 204 blink::ScopedCoalescedWebInputEvent input_event,
205 const ui::LatencyInfo& latency_info, 205 const ui::LatencyInfo& latency_info,
206 const InputEventAckStateCallback& callback) { 206 const InputEventAckStateCallback& callback) {
207 DCHECK(task_runner_->BelongsToCurrentThread()); 207 DCHECK(task_runner_->BelongsToCurrentThread());
208 TRACE_EVENT1("input,benchmark,rail", "InputHandlerManager::HandleInputEvent", 208 TRACE_EVENT1("input,benchmark,rail", "InputHandlerManager::HandleInputEvent",
209 "type", WebInputEvent::GetName(input_event->type)); 209 "type", WebInputEvent::GetName(input_event->event().type));
210 210
211 auto it = input_handlers_.find(routing_id); 211 auto it = input_handlers_.find(routing_id);
212 if (it == input_handlers_.end()) { 212 if (it == input_handlers_.end()) {
213 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent", 213 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent",
214 "result", "NoInputHandlerFound"); 214 "result", "NoInputHandlerFound");
215 // Oops, we no longer have an interested input handler.. 215 // Oops, we no longer have an interested input handler..
216 callback.Run(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, std::move(input_event), 216 callback.Run(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, std::move(input_event),
217 latency_info, nullptr); 217 latency_info, nullptr);
218 return; 218 return;
219 } 219 }
220 220
221 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent", 221 TRACE_EVENT1("input,rail", "InputHandlerManager::HandleInputEvent",
222 "result", "EventSentToInputHandlerProxy"); 222 "result", "EventSentToInputHandlerProxy");
223 InputHandlerProxy* proxy = it->second->input_handler_proxy(); 223 InputHandlerProxy* proxy = it->second->input_handler_proxy();
224 proxy->HandleInputEventWithLatencyInfo( 224 proxy->HandleInputEventWithLatencyInfo(
225 std::move(input_event), latency_info, 225 std::move(input_event), latency_info,
226 base::Bind(&InputHandlerManager::DidHandleInputEventAndOverscroll, 226 base::Bind(&InputHandlerManager::DidHandleInputEventAndOverscroll,
227 weak_ptr_factory_.GetWeakPtr(), callback)); 227 weak_ptr_factory_.GetWeakPtr(), callback));
228 } 228 }
229 229
230 void InputHandlerManager::DidHandleInputEventAndOverscroll( 230 void InputHandlerManager::DidHandleInputEventAndOverscroll(
231 const InputEventAckStateCallback& callback, 231 const InputEventAckStateCallback& callback,
232 InputHandlerProxy::EventDisposition event_disposition, 232 InputHandlerProxy::EventDisposition event_disposition,
233 ui::ScopedWebInputEvent input_event, 233 blink::ScopedCoalescedWebInputEvent input_event,
234 const ui::LatencyInfo& latency_info, 234 const ui::LatencyInfo& latency_info,
235 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) { 235 std::unique_ptr<ui::DidOverscrollParams> overscroll_params) {
236 InputEventAckState input_event_ack_state = 236 InputEventAckState input_event_ack_state =
237 InputEventDispositionToAck(event_disposition); 237 InputEventDispositionToAck(event_disposition);
238 switch (input_event_ack_state) { 238 switch (input_event_ack_state) {
239 case INPUT_EVENT_ACK_STATE_CONSUMED: 239 case INPUT_EVENT_ACK_STATE_CONSUMED:
240 renderer_scheduler_->DidHandleInputEventOnCompositorThread( 240 renderer_scheduler_->DidHandleInputEventOnCompositorThread(
241 *input_event, 241 *input_event,
242 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR); 242 RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
243 break; 243 break;
(...skipping 25 matching lines...) Expand all
269 void InputHandlerManager::NeedsMainFrame(int routing_id) { 269 void InputHandlerManager::NeedsMainFrame(int routing_id) {
270 DCHECK(task_runner_->BelongsToCurrentThread()); 270 DCHECK(task_runner_->BelongsToCurrentThread());
271 auto it = input_handlers_.find(routing_id); 271 auto it = input_handlers_.find(routing_id);
272 if (it == input_handlers_.end()) 272 if (it == input_handlers_.end())
273 return; 273 return;
274 it->second->NeedsMainFrame(); 274 it->second->NeedsMainFrame();
275 } 275 }
276 276
277 void InputHandlerManager::DispatchNonBlockingEventToMainThread( 277 void InputHandlerManager::DispatchNonBlockingEventToMainThread(
278 int routing_id, 278 int routing_id,
279 ui::ScopedWebInputEvent event, 279 blink::ScopedCoalescedWebInputEvent event,
280 const ui::LatencyInfo& latency_info) { 280 const ui::LatencyInfo& latency_info) {
281 DCHECK(task_runner_->BelongsToCurrentThread()); 281 DCHECK(task_runner_->BelongsToCurrentThread());
282 client_->DispatchNonBlockingEventToMainThread(routing_id, std::move(event), 282 client_->DispatchNonBlockingEventToMainThread(routing_id, std::move(event),
283 latency_info); 283 latency_info);
284 } 284 }
285 285
286 } // namespace content 286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698