[webkit-changes] [WebKit/WebKit] bf82da: Add a "post rendering frame" hook

Simon Fraser noreply at github.com
Fri Dec 23 15:58:28 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bf82da4c0e3bbd409f44510fa9f3d1891808d770
      https://github.com/WebKit/WebKit/commit/bf82da4c0e3bbd409f44510fa9f3d1891808d770
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2022-12-23 (Fri, 23 Dec 2022)

  Changed paths:
    M Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/platform/cf/RunLoopObserver.cpp
    M Source/WebCore/platform/cf/RunLoopObserver.h
    M Source/WebKit/WebProcess/WebPage/DrawingArea.cpp
    M Source/WebKit/WebProcess/WebPage/DrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
    M Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Source/WebKitLegacy/mac/WebView/WebViewInternal.h
    M Source/WebKitLegacy/mac/WebView/WebViewRenderingUpdateScheduler.h
    M Source/WebKitLegacy/mac/WebView/WebViewRenderingUpdateScheduler.mm

  Log Message:
  -----------
  Add a "post rendering frame" hook
https://bugs.webkit.org/show_bug.cgi?id=249807
rdar://103648840

Reviewed by Chris Dumez and Ryosuke Niwa.

We need to add a Page-level "post rendering frame" hook so we can do things like hook up
postRequestAnimationFrame() (webkit.org/b/249798), possibly run the WindowEventLoop
(webkit.org/b/249684) and correctly implement Inspectors "frame end" event (webkit.org/b/249796).

For Core Animation-driven drawing clients (TiledCoreAnimationDrawingArea, WebKitLegacy) we want this
post-rendering frame hook to run after CA's runloop observer returns, since this callback may run
arbitrary script at some point and we need to avoid any possible re-entrancy issues. So we use a
second CFRunLoopObserver, ordered as CoreAnimationCommit+2 (after InspectorFrameEnd).

For RemoteLayerTreeDrawingArea, we can just call the entry point after
didCompleteRenderingUpdateDisplay().

* Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStart):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::didCompleteRenderingFrame):
* Source/WebCore/page/Page.h:
* Source/WebCore/platform/cf/RunLoopObserver.cpp:
(WebCore::RunLoopObserver::schedule):
* Source/WebCore/platform/cf/RunLoopObserver.h: Modernize terminology: LayerFlush -> RenderingUpdate and add PostRenderingUpdate.
* Source/WebKit/WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::didCompleteRenderingFrame):
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCompleteRenderingFrame):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
(WebKit::TiledCoreAnimationDrawingArea::didCompleteRenderingUpdateDisplay):
(WebKit::TiledCoreAnimationDrawingArea::scheduleRenderingUpdateRunLoopObserver):
(WebKit::TiledCoreAnimationDrawingArea::invalidateRenderingUpdateRunLoopObserver):
(WebKit::TiledCoreAnimationDrawingArea::renderingUpdateRunLoopCallback):
(WebKit::TiledCoreAnimationDrawingArea::schedulePostRenderingUpdateRunLoopObserver):
(WebKit::TiledCoreAnimationDrawingArea::invalidatePostRenderingUpdateRunLoopObserver):
(WebKit::TiledCoreAnimationDrawingArea::postRenderingUpdateRunLoopCallback):
(WebKit::TiledCoreAnimationDrawingArea::updateRenderingRunLoopCallback): Deleted.
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView _didCompleteRenderingUpdateDisplay]):
* Source/WebKitLegacy/mac/WebView/WebViewData.mm:
(WebViewLayerFlushScheduler::WebViewLayerFlushScheduler):

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




More information about the webkit-changes mailing list