[webkit-changes] [WebKit/WebKit] 709072: deadline-max-rAF.html fails

Ryosuke Niwa noreply at github.com
Thu Aug 17 12:04:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7090728677dd90e4c86e2fe9764e4c0008e049c2
      https://github.com/WebKit/WebKit/commit/7090728677dd90e4c86e2fe9764e4c0008e049c2
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF.html
    M LayoutTests/platform/ios-wk2/TestExpectations
    A LayoutTests/requestidlecallback/requestidlecallback-deadline-cap-by-rendering-update-expected.txt
    A LayoutTests/requestidlecallback/requestidlecallback-deadline-cap-by-rendering-update.html
    M Source/WebCore/dom/IdleDeadline.cpp
    M Source/WebCore/dom/WindowEventLoop.cpp
    M Source/WebCore/dom/WindowEventLoop.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Performance.cpp
    M Source/WebCore/page/Performance.h

  Log Message:
  -----------
  deadline-max-rAF.html fails
https://bugs.webkit.org/show_bug.cgi?id=260183

Reviewed by Antti Koivisto.

This PR fixes a number of issues to make requestidlecallback/deadline-max-rAF.html pass.

1. Due to rounding errors / loss of precision, IdleDeadline::timeRemaining could return a time
that is off by 1ms or 20us, which ever is currently used for the time precision. We now ensure
this off-by-one-time-unit issue does not affect idle callbacks by always subtracting the same
amount from the remaining time. Since timeRemaining is defined to be an upper cap, this is fine.

2. didFinishRenderingUpdate was erroneously removing Page from m_pagesWithRenderingOpportunity
when the next rendering update has been scheduled within the current rendering update. Moved
the removal of the entry to at the beginning of Page::updateRendering so that subsequent
scheduling of rendering update within this rendering update does not end up getting cleared.

3. shouldEndIdlePeriod would return true whenever m_pagesWithRenderingOpportunity contains any
entry, which would effectively disable idle callbacks when there is any pending rendering update.
We now return true only if the next rendering update is happening within the next 4ms.

Unfortunately, this PR doesn't remove PASS FAIL expectation from deadline-max-rAF.html because
the test fails intermittently on the stress bots, and adding any logging to help debug the issue
will make the test no longer flaky, not providing means to debug it. Instead, this PR introduces
a new layout test to test the same scenario.

* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-dynamic.html:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-max-rAF.html:
* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/requestidlecallback/requestidlecallback-deadline-cap-by-rendering-update-expected.txt: Added.
* LayoutTests/requestidlecallback/requestidlecallback-deadline-cap-by-rendering-update.html: Added.

* Source/WebCore/dom/IdleDeadline.cpp:
(WebCore::IdleDeadline::timeRemaining const): Fixed off-by-one error (1).

* Source/WebCore/dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::didStartRenderingUpdate): Renamed from didFinishRenderingUpdate.
(WebCore::WindowEventLoop::opportunisticallyRunIdleCallbacks):
(WebCore::WindowEventLoop::shouldEndIdlePeriod): Now takes the current timestamp and only returns
true if the next rendering update is happening within the next 4ms instead of whenever (3).
(WebCore::WindowEventLoop::computeIdleDeadline):
(WebCore::WindowEventLoop::nextRenderingTime const): Added.

* Source/WebCore/dom/WindowEventLoop.h:

* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateRendering): Moved the call to didStartRenderingUpdate (previously named
didFinishRenderingUpdate) here so that rendering update scheduled within this rendering update
doesn't get cleared at the end of the current rendering update (2).
(WebCore::Page::renderingUpdateCompleted):

* Source/WebCore/page/Performance.cpp:
(WebCore::Performance::timeResolution): Added.

* Source/WebCore/page/Performance.h:

Canonical link: https://commits.webkit.org/267008@main




More information about the webkit-changes mailing list