New issue
Advanced search Search tips

Issue 755604 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug

Blocking:
issue 706175



Sign in to add a comment

Async Wheel Events shouldn't block on wheel listeners

Project Member Reported by bokan@chromium.org, Aug 15 2017

Issue description

Chrome Version       : 62.0.3178.0
OS Version: Linux
URLs (if applicable) : https://rbyers.github.io/scroll-latency.html

What steps will reproduce the problem?
0. Run Chrome with --enable-features="AsyncWheelEvents,TouchpadAndWheelScrollLatching"
1. Enable "Handler Jank"
2. Scroll up and down with the mouse wheel

What is the expected result?
The first wheel should be janky but all following wheel ticks should cause smooth scrolling.

What happens instead of that?
Wheels are clearly being sent to the main thread where they only scroll after the handler has been processed.

Sahel, am I doing something wrong? We need to make sure that if AsyncWheelEvents is turned on then only the first wheel needs to go to the main thread. If that's not preventDefaulted then we can send all following WheelEvents' GSUs directly to CC.

I've attached a trace of me scrolling around on that page.
 
trace_asyncwheel.json.gz
2.0 MB Download

Comment 1 by bokan@chromium.org, Aug 15 2017

Blocking: 706175

Comment 2 by sahel@chromium.org, Sep 26 2017

Cc: dtapu...@chromium.org
Status: Started (was: Assigned)
With async wheel events, we still send wheel events to the main thread but scrolling does not block on handling wheel events, so it should be smooth regardless of the jank on main thread. However, wheel events end up being queued in main thread side for a long time if the thread is busy doing something else.

Please let me know if this is bot the behavior that you expect.

Comment 3 by bokan@chromium.org, Sep 26 2017

That's right, my original report is wrong in that we do expect wheel events to be going to main. Eventually we should throttle or coalesce the wheel events if the main thread gets busy - but we can work out that behavior later.

The important bit now is that scrolling _should_ block on the first wheel event, but only on the first one. So we shouldn't scroll if the first wheel event is 'preventDefault()'ed. In the case above, we shouldn't be janking after the first wheel has been handled. IIRC, last we chatted about this it was likely that the timeout was too short and that we were starting a new gesture stream each time, right? Maybe all we need to do is tweak the ScrollEnd timeout?

Comment 4 by sahel@chromium.org, Sep 26 2017

If you keep scrolling with mouse wheel after a while the scrolling seems janky. This is because the timer based timeouts happen often and we end up with a bunch of wheel event sequences like phaseBegan, phaseChanged *n, phaseEnded. The scroll seems blocked on main thread because wheel events with phaseBegan are en-queued among other wheel events and scroll is blocked on processing of wheels with phaseBegan.
I can think of three possible solutions here:
1- Coalescing wheel events with phase changed in main thread queue.
2- Not sending non blocking wheel events to the main thread if the first one is not preventDefaulted.
3- Increasing the timeout time to have fewer number of wheel events with phaseBegan, this might be tricky since we don't break latching on mouse move.

Any preferences on which option to choose? 
 

Comment 5 by bokan@chromium.org, Sep 26 2017

> this might be tricky since we don't break latching on mouse move.

What's the failure scenario here, that someone will move their mouse and want to scroll on something else but we'll still be latched to the other scroller? I think our current timeout is well below the timescale of the user so I think we have some room to work with here. IMO, lets do #3 first and then #1 if we find we can't push the timeout higher.
Can we have a longer latch time, but then reduce it on mousemove?

Comment 7 by bokan@chromium.org, Sep 26 2017

Yeah, presumably we could do that but use a slop region so we don't reset for ~1-2 pixel jitters

Comment 8 by sahel@chromium.org, Mar 7 2018

Status: Fixed (was: Started)
Comment 6 and 7 are addressed: The timer timeout is 500ms and it expires if the mouse moves further than 10 pixels.

Sign in to add a comment