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

Side by Side Diff: ui/events/blink/input_handler_proxy.cc

Issue 2869823003: [VSync Queue] Plug touch ack to gesture events and flush vsync queue if necessary (Closed)
Patch Set: dtapuska's comment: Use ack to determine blocking vs. non-blocking Created 3 years, 7 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 "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // Note: Other input can race ahead of gesture input as they don't have to go 315 // Note: Other input can race ahead of gesture input as they don't have to go
316 // through the queue, but we believe it's OK to do so. 316 // through the queue, but we believe it's OK to do so.
317 if (!compositor_event_queue_ || 317 if (!compositor_event_queue_ ||
318 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) { 318 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) {
319 DispatchSingleInputEvent(std::move(event_with_callback), 319 DispatchSingleInputEvent(std::move(event_with_callback),
320 tick_clock_->NowTicks()); 320 tick_clock_->NowTicks());
321 return; 321 return;
322 } 322 }
323 323
324 if (has_ongoing_compositor_scroll_fling_pinch_) { 324 if (has_ongoing_compositor_scroll_fling_pinch_) {
325 const auto& gesture_event = ToWebGestureEvent(event_with_callback->event());
326 if (gesture_event.source_device == blink::kWebGestureDeviceTouchscreen &&
327 gesture_event.source_touch_event_dispatch_type ==
328 WebInputEvent::kBlocking) {
329 // Dispatch immediately to reduce latency.
330 compositor_event_queue_->Queue(std::move(event_with_callback),
331 tick_clock_->NowTicks());
332 DispatchQueuedInputEvents();
333 return;
334 }
335
325 bool needs_animate_input = compositor_event_queue_->empty(); 336 bool needs_animate_input = compositor_event_queue_->empty();
326 compositor_event_queue_->Queue(std::move(event_with_callback), 337 compositor_event_queue_->Queue(std::move(event_with_callback),
327 tick_clock_->NowTicks()); 338 tick_clock_->NowTicks());
328 if (needs_animate_input) 339 if (needs_animate_input)
329 input_handler_->SetNeedsAnimateInput(); 340 input_handler_->SetNeedsAnimateInput();
330 return; 341 return;
331 } 342 }
332 343
333 // We have to dispatch the event to know whether the gesture sequence will be 344 // We have to dispatch the event to know whether the gesture sequence will be
334 // handled by the compositor or not. 345 // handled by the compositor or not.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 377 }
367 } 378 }
368 379
369 ui::LatencyInfo monitored_latency_info = event_with_callback->latency_info(); 380 ui::LatencyInfo monitored_latency_info = event_with_callback->latency_info();
370 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor = 381 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor =
371 input_handler_->CreateLatencyInfoSwapPromiseMonitor( 382 input_handler_->CreateLatencyInfoSwapPromiseMonitor(
372 &monitored_latency_info); 383 &monitored_latency_info);
373 384
374 current_overscroll_params_.reset(); 385 current_overscroll_params_.reset();
375 InputHandlerProxy::EventDisposition disposition = 386 InputHandlerProxy::EventDisposition disposition =
376 HandleInputEvent(event_with_callback->event()); 387 HandleInputEvent(event_with_callback->event());
chongz 2017/05/25 20:25:28 sadrul@ Just to recall: During our in-person discu
sadrul 2017/06/01 19:57:17 @dtapuska@: Can you confirm if this can happen? A
377 388
378 switch (event_with_callback->event().GetType()) { 389 switch (event_with_callback->event().GetType()) {
379 case blink::WebGestureEvent::kGestureScrollBegin: 390 case blink::WebGestureEvent::kGestureScrollBegin:
380 case blink::WebGestureEvent::kGestureFlingStart: 391 case blink::WebGestureEvent::kGestureFlingStart:
381 case blink::WebGestureEvent::kGesturePinchBegin: 392 case blink::WebGestureEvent::kGesturePinchBegin:
382 case blink::WebGestureEvent::kGestureScrollUpdate: 393 case blink::WebGestureEvent::kGestureScrollUpdate:
383 case blink::WebGestureEvent::kGesturePinchUpdate: 394 case blink::WebGestureEvent::kGesturePinchUpdate:
384 has_ongoing_compositor_scroll_fling_pinch_ = disposition == DID_HANDLE; 395 has_ongoing_compositor_scroll_fling_pinch_ = disposition == DID_HANDLE;
385 break; 396 break;
386 397
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1655 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1645 scroll_result)); 1656 scroll_result));
1646 } 1657 }
1647 1658
1648 void InputHandlerProxy::SetTickClockForTesting( 1659 void InputHandlerProxy::SetTickClockForTesting(
1649 std::unique_ptr<base::TickClock> tick_clock) { 1660 std::unique_ptr<base::TickClock> tick_clock) {
1650 tick_clock_ = std::move(tick_clock); 1661 tick_clock_ = std::move(tick_clock);
1651 } 1662 }
1652 1663
1653 } // namespace ui 1664 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698