Use deferrable timer to restart the Responsiveness Timer on each wheel event
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 22:30:31 +0000 (22:30 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Feb 2019 22:30:31 +0000 (22:30 +0000)
commit8b5396888345285bdaab2c5b03ece177e7056c2b
treea400104c63f92458235227ae7ac716c98396c4a4
parent7cffd3506c35c7dbc0e0344d8cbbff954bce095d
Use deferrable timer to restart the Responsiveness Timer on each wheel event
https://bugs.webkit.org/show_bug.cgi?id=194135
Source/WebCore:

<rdar://problem/47724099>

Reviewed by Simon Fraser.

The original DeferrableOneShotTimer was not really deferrable.
What it allows is to restart the count down from scratch after
firing.

For this optimization, I want to keep the correct timing but avoid
starting a real timer every time.

I renamed DeferrableOneShotTimer to ResettableOneShotTimer and
created a real DeferrableOneShotTimer that support deadlines.

* css/CSSImageGeneratorValue.cpp:
* html/HTMLPlugInImageElement.h:
* loader/cache/CachedResource.h:
* platform/Timer.cpp:
(WebCore::DeferrableOneShotTimer::startOneShot):
(WebCore::DeferrableOneShotTimer::fired):
* platform/Timer.h:
(WebCore::TimerBase::nextFireTime const):
(WebCore::ResettableOneShotTimer::ResettableOneShotTimer):
(WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
(WebCore::DeferrableOneShotTimer::stop):
(WebCore::DeferrableOneShotTimer::restart): Deleted.
* platform/graphics/ca/TileController.h:
* platform/graphics/cg/SubimageCacheWithTimer.h:

Source/WebKit:

Reviewed by Simon Fraser.

Simon Fraser suggested a neat improvement over my previous optimization
of ResponsivenessTimer.

Instead of reseting the deadline with every event, we can let the timer
fire and add the missing time from the last start.

I implemented that behavior in the new Deferrable Timer class and use
it from ResponsivenessTimer.

* NetworkProcess/watchos/NetworkProximityAssertion.h:
* UIProcess/ResponsivenessTimer.h:
* WebProcess/Plugins/PluginView.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSImageGeneratorValue.cpp
Source/WebCore/html/HTMLPlugInImageElement.h
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/platform/Timer.cpp
Source/WebCore/platform/Timer.h
Source/WebCore/platform/graphics/ca/TileController.h
Source/WebCore/platform/graphics/cg/SubimageCacheWithTimer.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.h
Source/WebKit/UIProcess/ResponsivenessTimer.cpp
Source/WebKit/UIProcess/ResponsivenessTimer.h
Source/WebKit/WebProcess/Plugins/PluginView.h