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

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

Issue 2746513002: [Compositor event queue] Queue GestureFlingStart/Cancel together with scroll/pinch (Closed)
Patch Set: dtapuska@'s review 2: Use IsGestureScrollOrFlingOrPinch Created 3 years, 9 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
« no previous file with comments | « ui/events/blink/blink_event_util.cc ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, 304 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
305 "step", "HandleInputEventImpl"); 305 "step", "HandleInputEventImpl");
306 306
307 std::unique_ptr<EventWithCallback> event_with_callback = 307 std::unique_ptr<EventWithCallback> event_with_callback =
308 base::MakeUnique<EventWithCallback>(std::move(event), latency_info, 308 base::MakeUnique<EventWithCallback>(std::move(event), latency_info,
309 tick_clock_->NowTicks(), callback); 309 tick_clock_->NowTicks(), callback);
310 310
311 // Note: Other input can race ahead of gesture input as they don't have to go 311 // Note: Other input can race ahead of gesture input as they don't have to go
312 // through the queue, but we believe it's OK to do so. 312 // through the queue, but we believe it's OK to do so.
313 if (!compositor_event_queue_ || 313 if (!compositor_event_queue_ ||
314 !IsGestureScollOrPinch(event_with_callback->event().type())) { 314 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().type())) {
315 DispatchSingleInputEvent(std::move(event_with_callback), 315 DispatchSingleInputEvent(std::move(event_with_callback),
316 tick_clock_->NowTicks()); 316 tick_clock_->NowTicks());
317 return; 317 return;
318 } 318 }
319 319
320 if (has_ongoing_compositor_scroll_pinch_) { 320 if (has_ongoing_compositor_scroll_pinch_) {
321 bool needs_animate_input = compositor_event_queue_->empty(); 321 bool needs_animate_input = compositor_event_queue_->empty();
322 compositor_event_queue_->Queue(std::move(event_with_callback), 322 compositor_event_queue_->Queue(std::move(event_with_callback),
323 tick_clock_->NowTicks()); 323 tick_clock_->NowTicks());
324 if (needs_animate_input) 324 if (needs_animate_input)
325 input_handler_->SetNeedsAnimateInput(); 325 input_handler_->SetNeedsAnimateInput();
326 return; 326 return;
327 } 327 }
328 328
329 // We have to dispatch the event to know whether the gesture sequence will be 329 // We have to dispatch the event to know whether the gesture sequence will be
330 // handled by the compositor or not. 330 // handled by the compositor or not.
331 DispatchSingleInputEvent(std::move(event_with_callback), 331 DispatchSingleInputEvent(std::move(event_with_callback),
332 tick_clock_->NowTicks()); 332 tick_clock_->NowTicks());
333 } 333 }
334 334
335 void InputHandlerProxy::DispatchSingleInputEvent( 335 void InputHandlerProxy::DispatchSingleInputEvent(
336 std::unique_ptr<EventWithCallback> event_with_callback, 336 std::unique_ptr<EventWithCallback> event_with_callback,
337 const base::TimeTicks now) { 337 const base::TimeTicks now) {
338 if (compositor_event_queue_ && 338 if (compositor_event_queue_ &&
339 IsGestureScollOrPinch(event_with_callback->event().type())) { 339 IsGestureScrollOrFlingOrPinch(event_with_callback->event().type())) {
340 // Report the coalesced count only for continuous events to avoid the noise 340 // Report the coalesced count only for continuous events to avoid the noise
341 // from non-continuous events. 341 // from non-continuous events.
342 if (IsContinuousGestureEvent(event_with_callback->event().type())) { 342 if (IsContinuousGestureEvent(event_with_callback->event().type())) {
343 UMA_HISTOGRAM_CUSTOM_COUNTS( 343 UMA_HISTOGRAM_CUSTOM_COUNTS(
344 "Event.CompositorThreadEventQueue.Continuous.HeadQueueingTime", 344 "Event.CompositorThreadEventQueue.Continuous.HeadQueueingTime",
345 (now - event_with_callback->creation_timestamp()).InMicroseconds(), 1, 345 (now - event_with_callback->creation_timestamp()).InMicroseconds(), 1,
346 kTenSeconds, 50); 346 kTenSeconds, 50);
347 347
348 UMA_HISTOGRAM_CUSTOM_COUNTS( 348 UMA_HISTOGRAM_CUSTOM_COUNTS(
349 "Event.CompositorThreadEventQueue.Continuous.TailQueueingTime", 349 "Event.CompositorThreadEventQueue.Continuous.TailQueueingTime",
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1614 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1615 scroll_result)); 1615 scroll_result));
1616 } 1616 }
1617 1617
1618 void InputHandlerProxy::SetTickClockForTesting( 1618 void InputHandlerProxy::SetTickClockForTesting(
1619 std::unique_ptr<base::TickClock> tick_clock) { 1619 std::unique_ptr<base::TickClock> tick_clock) {
1620 tick_clock_ = std::move(tick_clock); 1620 tick_clock_ = std::move(tick_clock);
1621 } 1621 }
1622 1622
1623 } // namespace ui 1623 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/blink_event_util.cc ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698