Bug 194135 - Use deferrable timer to restart the Responsiveness Timer on each wheel event
Summary: Use deferrable timer to restart the Responsiveness Timer on each wheel event
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-31 18:48 PST by Benjamin Poulain
Modified: 2019-02-04 14:30 PST (History)
6 users (show)

See Also:


Attachments
Patch (13.02 KB, patch)
2019-01-31 20:40 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (14.38 KB, patch)
2019-02-01 16:19 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.58 MB, application/zip)
2019-02-01 18:36 PST, EWS Watchlist
no flags Details
Patch (15.68 KB, patch)
2019-02-01 19:02 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2019-01-31 18:48:09 PST
Use deferrable timer to restart the Responsiveness on each wheel event
Comment 1 Benjamin Poulain 2019-01-31 20:40:56 PST
Created attachment 360824 [details]
Patch
Comment 2 Benjamin Poulain 2019-01-31 20:42:40 PST
@Simon: that was a really good idea. I could not use Deferrable timers directly but a simple variant makes everything work.

I'll test tomorrow that everything still works as expected. The perf looks great though.
Comment 3 Benjamin Poulain 2019-02-01 16:19:26 PST
Created attachment 360922 [details]
Patch
Comment 4 Benjamin Poulain 2019-02-01 16:20:27 PST
Ok, this time I verified responsiveness still works as expected.

I found more cases to improve during testing. I'll do a follow up patch since it's a bit unrelated with this optimization.
Comment 5 Simon Fraser (smfr) 2019-02-01 17:25:12 PST
Comment on attachment 360922 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=360922&action=review

> Source/WebCore/ChangeLog:3
> +        Use deferrable timer to restart the Responsiveness on each wheel event

"the Responsiveness"?

> Source/WebCore/ChangeLog:17
> +        created a real DeferrableOneShotTimer that support dealines.

deadlines

> Source/WebCore/platform/Timer.cpp:554
> +void DeferrableOneShotTimer::stop()
> +{
> +    TimerBase::stop();
> +}

Can you just remove this?

> Source/WebCore/platform/Timer.h:204
> +class WEBCORE_EXPORT DeferrableOneShotTimer : private TimerBase {

I think you need some comments explaining the difference between DeferrableOneShotTimer and ResettableOneShotTimer. How are devs supposed to know which one to use?
Comment 6 EWS Watchlist 2019-02-01 18:36:44 PST
Comment on attachment 360922 [details]
Patch

Attachment 360922 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/11001806

New failing tests:
imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
Comment 7 EWS Watchlist 2019-02-01 18:36:46 PST
Created attachment 360944 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 8 Benjamin Poulain 2019-02-01 19:02:01 PST
Created attachment 360946 [details]
Patch
Comment 9 Benjamin Poulain 2019-02-01 19:05:44 PST
I added some documentation.

Tell me what you think.

> > Source/WebCore/platform/Timer.cpp:554
> > +void DeferrableOneShotTimer::stop()
> > +{
> > +    TimerBase::stop();
> > +}
> 
> Can you just remove this?

Unfortunately no. I can't inherit TimerBase publicly since I can't expose the other methods.
Comment 10 Simon Fraser (smfr) 2019-02-02 12:03:09 PST
Comment on attachment 360946 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=360946&action=review

> Source/WebCore/ChangeLog:11
> +        The original DeferrableOneShotTimer was not really deferrable.
> +        What it allows is to restart the count down from scratch after
> +        firing.

That actually surprised me. I wonder if we actually need both types.

DeferrableOneShotTimer came in via https://trac.webkit.org/changeset/118942/webkit.
Comment 11 Benjamin Poulain 2019-02-02 20:27:17 PST
(In reply to Simon Fraser (smfr) from comment #10)
> That actually surprised me. I wonder if we actually need both types.

Me too. It seems like a very odd way to use a timer...

I can try a follow up where I get rid of ResettableOneShotTimer but that seems a bit risky given the variety of uses :(
Comment 12 Darin Adler 2019-02-03 11:22:21 PST
If we feel that DeferrableOneShotTimer is not a good name for the class that currently has that name, I think we should rename for clarity, even if we later decide to get rid of it for economy.
Comment 13 Benjamin Poulain 2019-02-04 14:05:42 PST
Comment on attachment 360946 [details]
Patch

Thanks for the review!
Comment 14 WebKit Commit Bot 2019-02-04 14:30:37 PST
Comment on attachment 360946 [details]
Patch

Clearing flags on attachment: 360946

Committed r240944: <https://trac.webkit.org/changeset/240944>
Comment 15 WebKit Commit Bot 2019-02-04 14:30:39 PST
All reviewed patches have been landed.  Closing bug.