[webkit-changes] [WebKit/WebKit] b7bc61: Implement timeout for idle callbacks

Ryosuke Niwa noreply at github.com
Wed Aug 9 16:17:49 PDT 2023


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/basic-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer-expected.txt
    M LayoutTests/platform/ios-wk2/TestExpectations
    M LayoutTests/platform/mac-wk2/TestExpectations
    A LayoutTests/requestidlecallback/requestidlecallback-deadline-expected.txt
    A LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update-expected.txt
    A LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update.html
    A LayoutTests/requestidlecallback/requestidlecallback-deadline.html
    M Source/WebCore/dom/IdleCallbackController.cpp
    M Source/WebCore/dom/IdleCallbackController.h
    M Source/WebCore/dom/IdleDeadline.cpp
    M Source/WebCore/dom/IdleDeadline.h
    M Source/WebCore/dom/WindowEventLoop.cpp
    M Source/WebCore/dom/WindowEventLoop.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl

  Log Message:
  -----------
  Implement timeout for idle callbacks
https://bugs.webkit.org/show_bug.cgi?id=259866

Reviewed by Chris Dumez.

This PR adds the support for idle callbacks' timeout. It also moves the logic of computing the idle deadline
to WindowEventLoop, which now keeps track of WeakHashMap of Page to its next rendering update time.

* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/basic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/deadline-after-expired-timer-expected.txt:
* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/requestidlecallback/requestidlecallback-deadline-expected.txt: Added.
* LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update-expected.txt: Added.
* LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update.html: Added.
* LayoutTests/requestidlecallback/requestidlecallback-deadline.html: Added.

* Source/WebCore/dom/IdleCallbackController.cpp:
* Source/WebCore/dom/IdleCallbackController.cpp:
(WebCore::IdleCallbackController::queueIdleCallback): Schedule a timer for the timeout.
(WebCore::IdleCallbackController::startIdlePeriod):
(WebCore::IdleCallbackController::queueTaskToInvokeIdleCallbacks):
(WebCore::IdleCallbackController::invokeIdleCallbacks):
(WebCore::IdleCallbackController::invokeIdleCallbackTimeout): Added.

* Source/WebCore/dom/IdleCallbackController.h:

* Source/WebCore/dom/IdleDeadline.cpp:
(WebCore::IdleDeadline::timeRemaining const):
(WebCore::IdleDeadline::didTimeout const): Moved to the header file.

* Source/WebCore/dom/IdleDeadline.h:
(WebCore::IdleDeadline::create): Now takes DidTimeout enum class.
(WebCore::IdleDeadline::IdleDeadline): Ditto.
(WebCore::IdleDeadline::didTimeout const): Moved. Now trivially checks m_didTimeout.

* Source/WebCore/dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::didScheduleRenderingUpdate): Moved from the header. Now takes a Page adds to the map
of pages with pending rendering opportunities.
(WebCore::WindowEventLoop::didFinishRenderingUpdate): Ditto removes it from the map.
(WebCore::WindowEventLoop::opportunisticallyRunIdleCallbacks):
(WebCore::WindowEventLoop::shouldEndIdlePeriod):
(WebCore::WindowEventLoop::computeIdleDeadline): Added.

* Source/WebCore/dom/WindowEventLoop.h:

* Source/WebCore/page/Page.cpp:
(WebCore::Page::scheduleRenderingUpdateInternal):
(WebCore::Page::renderingUpdateCompleted):

* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::preferredRenderingUpdateInterval):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

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




More information about the webkit-changes mailing list