Bug 208709

Summary: Break out of timer loop on display refresh
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ggaren, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
wip none

Description Antti Koivisto 2020-03-06 05:52:13 PST
We currently process timers for 50ms in a loop. We should break out immediately when there is a display refresh to allow rendering update.
Comment 1 Antti Koivisto 2020-03-06 05:54:39 PST
Created attachment 392711 [details]
wip
Comment 2 Simon Fraser (smfr) 2020-03-06 07:58:44 PST
Comment on attachment 392711 [details]
wip

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

> Source/WebCore/platform/ThreadTimers.cpp:129
> +        if (DisplayRefreshMonitorManager::sharedManager().hasPendingRefresh() && !m_didBreakForPendingDisplayRefreshWithoutFiringTimers) {

It's a bit gross for timers to know about DisplayRefreshMonitorManager, and we need something that works on iOS too.

> Source/WebCore/platform/graphics/DisplayRefreshMonitor.h:86
> +    WEBCORE_EXPORT void setIsPreviousFrameDone(bool);

I presume this is WEBCORE_EXPORT just to satisfy the linker, not because anyone else calls it (because it doesn't lock).

> Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp:250
> +    DisplayRefreshMonitorManager::sharedManager().displayWasUpdated(displayID);

Which thread are we on here?

DisplayRefreshMonitorManager::displayWasUpdated() doesn't look thread safe.