[webkit-changes] [WebKit/WebKit] f7971b: Integrate requestIdleCallback with HTML5 event loo...

Ryosuke Niwa noreply at github.com
Tue Aug 8 10:08:43 PDT 2023


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

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-idle-periods-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-multiple-calls-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-xhr-sync-expected.txt
    M LayoutTests/platform/ios-wk2/TestExpectations
    M LayoutTests/platform/mac-wk2/TestExpectations
    M LayoutTests/requestidlecallback/requestidlecallback-in-page-cache-expected.txt
    M LayoutTests/requestidlecallback/requestidlecallback-in-page-cache.html
    M LayoutTests/requestidlecallback/requestidlecallback-is-called-expected.txt
    M LayoutTests/requestidlecallback/requestidlecallback-is-called.html
    M LayoutTests/requestidlecallback/requestidlecallback-is-not-called-when-canceled-expected.txt
    M LayoutTests/requestidlecallback/requestidlecallback-is-not-called-when-canceled.html
    M Source/WebCore/dom/EventLoop.h
    M Source/WebCore/dom/IdleCallbackController.cpp
    M Source/WebCore/dom/IdleCallbackController.h
    M Source/WebCore/dom/Microtasks.h
    M Source/WebCore/dom/WindowEventLoop.cpp
    M Source/WebCore/dom/WindowEventLoop.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h

  Log Message:
  -----------
  Integrate requestIdleCallback with HTML5 event loop and OpportunisticTaskScheduler
https://bugs.webkit.org/show_bug.cgi?id=259850

Reviewed by Yusuke Suzuki.

This PR integrates WebKit's implementation of requestIdleCallback with HTML5 event loop and Page's
OpportunisticTaskScheduler. It also skips the tests on non-CF (non-Apple) ports as RunLoopObserver,
which is used by OpportunisticTaskScheduler isn't implemented on non-CF ports.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-idle-periods-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-multiple-calls-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-xhr-sync-expected.txt:
* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/requestidlecallback/requestidlecallback-in-page-cache-expected.txt: Updated the test to not
test the order of execution of tasks scheduled across distinct frames as we no longer have any guarantee
across them (as spec'ed).
* LayoutTests/requestidlecallback/requestidlecallback-in-page-cache.html: Ditto.
* LayoutTests/requestidlecallback/requestidlecallback-is-not-called-when-canceled-expected.txt: Ditto.
* LayoutTests/requestidlecallback/requestidlecallback-is-not-called-when-canceled.html: Ditto.

* Source/WebCore/dom/EventLoop.h:
(WebCore::EventLoop::hasTasksForFullyActiveDocument const): Added.

* Source/WebCore/dom/IdleCallbackController.cpp:
(WebCore::IdleCallbackController::queueIdleCallback):
(WebCore::IdleCallbackController::startIdlePeriod):

* Source/WebCore/dom/IdleCallbackController.h:

* Source/WebCore/dom/IdleDeadline.cpp:
(WebCore::IdleDeadline::didTimeout const): Deleted.

* Source/WebCore/dom/IdleDeadline.h:
(WebCore::IdleDeadline::create): Now takes DidTimeout enum as an argument.
(WebCore::IdleDeadline::didTimeout const): Moved from cpp file. Now simply checks DidTimeout given to
the constructor.

* Source/WebCore/dom/Microtasks.h:
(WebCore::MicrotaskQueue::isEmpty): Added.

* Source/WebCore/dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::opportunisticallyRunIdleCallbacks): Added.
(WebCore::WindowEventLoop::shouldEndIdlePeriod): Added.

* Source/WebCore/dom/WindowEventLoop.h:
(WebCore::WindowEventLoop::didScheduleRenderingUpdate): Added.
(WebCore::WindowEventLoop::didFinishRenderingUpdate): Added.

* Source/WebCore/page/Page.cpp:
(WebCore::Page::scheduleRenderingUpdateInternal): Added hooks for WindowEventLoop. This function is
used instead of didScheduleRenderingUpdate since the latter isn't called when the chrome client
scheduled the rendering update.
(WebCore::Page::doAfterUpdateRendering): Ditto.
(WebCore::Page::renderingUpdateCompleted):
(WebCore::Page::forEachWindowEventLoop): Added.
(WebCore::Page::performOpportunisticallyScheduledTasks): Call WindowEventLoop's
opportunisticallyRunIdleCallbacks to invoke idle callbacks.

* Source/WebCore/page/Page.h:

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




More information about the webkit-changes mailing list