[Webkit-unassigned] [Bug 249684] New: Prevent the WindowEventLoop tasks from running between trigger an rendering update and the end of that update

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 20 16:26:11 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=249684

            Bug ID: 249684
           Summary: Prevent the WindowEventLoop tasks from running between
                    trigger an rendering update and the end of that update
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: simon.fraser at apple.com

I was trying to implement `testRunner.renderingUpdate()` so you could write a test like:

        window.addEventListener('load', async () => {
            await testRunner.renderingUpdate();
            debug('rendering update complete');
            // do stuff
        }, false);


However, that turned out have flakey behavior with respect to the ordering of rAF callbacks:

        window.addEventListener('load', async () => {
            requestAnimationFrame(() => {
                debug('requestAnimationFrame callback');

                requestAnimationFrame(() => {
                    debug('second requestAnimationFrame callback, which should always come after the "rendering update complete"');
                });
            });

            await testRunner.renderingUpdate();
            debug('rendering update complete');
        }, false);

Sometimes the second rAF callback happened before "rendering update complete" and sometimes after. This depended on the timing of the microtask callbacks fired from WindowEventLoop, which I believe handles the resume of the load function when the `renderingUpdate` Promise is resolved.

The source of unpredictability which I identified was the timing of the zero-delay timer in WindowEventLoop. The incorrect behavior happened when the WindowEventLoop timer fired between `TiledCoreAnimationDrawingArea::scheduleRenderingUpdateRunLoopObserver()` and `TiledCoreAnimationDrawingArea::updateRenderingRunLoopCallback()`. There's already code that tries to avoid timing firing delaying the runloop observer for long periods of time (`breakToAllowRenderingUpdate()`), so we can piggyback off that to avoid this timer firing between the scheduling and the fire of the CFRunLoopObserver that controls the rendering update.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221221/e0bfb45e/attachment.htm>


More information about the webkit-unassigned mailing list