Bug 207889 - [macOS] Don't fire timers when there is a pending rendering update
Summary: [macOS] Don't fire timers when there is a pending rendering update
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-18 06:20 PST by Antti Koivisto
Modified: 2020-02-18 13:58 PST (History)
13 users (show)

See Also:


Attachments
patch (11.93 KB, patch)
2020-02-18 06:31 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (12.21 KB, patch)
2020-02-18 06:52 PST, Antti Koivisto
simon.fraser: review-
commit-queue: commit-queue-
Details | Formatted Diff | Diff
patch (12.13 KB, patch)
2020-02-18 11:48 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2020-02-18 06:20:22 PST
Rendering update may be significantly delayed by timers that fire after the document reaches visually non-empty state but before the CA synced runloop observer.
Comment 1 Antti Koivisto 2020-02-18 06:31:51 PST
Created attachment 391042 [details]
patch
Comment 2 Antti Koivisto 2020-02-18 06:52:45 PST
Created attachment 391044 [details]
patch
Comment 3 Radar WebKit Bug Importer 2020-02-18 07:05:48 PST
<rdar://problem/59548633>
Comment 4 WebKit Commit Bot 2020-02-18 10:56:00 PST
Comment on attachment 391044 [details]
patch

Rejecting attachment 391044 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 391044, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Logging in as commit-queue@webkit.org...
Fetching: https://bugs.webkit.org/attachment.cgi?id=391044&action=edit
Fetching: https://bugs.webkit.org/show_bug.cgi?id=207889&ctype=xml&excludefield=attachmentdata
Processing 1 patch from 1 bug.
Processing patch 391044 from bug 207889.
Fetching: https://bugs.webkit.org/attachment.cgi?id=391044
Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Dean Jackson']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Parsed 8 diffs from patch file(s).
patching file Source/WebCore/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebCore/WebCore.xcodeproj/project.pbxproj
Hunk #3 succeeded at 9184 (offset 1 line).
Hunk #4 succeeded at 12223 (offset 1 line).
patching file Source/WebCore/dom/WindowEventLoop.cpp
patching file Source/WebCore/dom/WindowEventLoop.h
patching file Source/WebCore/platform/ThreadTimers.cpp
patching file Source/WebCore/platform/ThreadTimers.h
patching file Source/WebKit/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Hunk #3 FAILED at 958.
1 out of 3 hunks FAILED -- saving rejects to file Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm.rej

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Dean Jackson']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: https://webkit-queues.webkit.org/results/13324547
Comment 5 Simon Fraser (smfr) 2020-02-18 11:07:59 PST
Comment on attachment 391044 [details]
patch

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

> Source/WebCore/dom/WindowEventLoop.cpp:161
> +void WindowEventLoop::spinForRenderingUpdate()
> +{
> +    // FIXME: Also bail out from the task loop in EventLoop::run().
> +    threadGlobalData().threadTimers().interruptFireLoopForRenderingUpdate();
> +}

I'm confused about the "spin" terminology. "Spin" could mean "block until something happens", like spinlock, or it could mean "allow the event loop to take a turn".

> Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:965
> +    WebCore::WindowEventLoop::spinForRenderingUpdate();

Why is this up here in TiledCoreAnimationDrawingArea? That doesn't apply to iOS. Shouldn't this mechanism be down in WebCore?
Comment 6 Antti Koivisto 2020-02-18 11:13:50 PST
> I'm confused about the "spin" terminology. "Spin" could mean "block until
> something happens", like spinlock, or it could mean "allow the event loop to
> take a turn".

I don't love it either. Suggestions?
 
> Why is this up here in TiledCoreAnimationDrawingArea? That doesn't apply to
> iOS. Shouldn't this mechanism be down in WebCore?

We don't use runloop observers on iOS, we use a timer. The solution there needs to be different (we need to be able to schedule a high priority timer that fires before any already scheduled 0 duration timers).
Comment 7 Antti Koivisto 2020-02-18 11:48:43 PST
Created attachment 391074 [details]
patch
Comment 8 WebKit Commit Bot 2020-02-18 13:58:17 PST
Comment on attachment 391074 [details]
patch

Clearing flags on attachment: 391074

Committed r256853: <https://trac.webkit.org/changeset/256853>
Comment 9 WebKit Commit Bot 2020-02-18 13:58:19 PST
All reviewed patches have been landed.  Closing bug.