[webkit-changes] [WebKit/WebKit] fc01b4: [Site isolation] Record the page snapshotting to a...

Said Abou-Hallawa noreply at github.com
Wed Feb 12 13:53:44 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fc01b4369ae0acd8cdda47914bd506df0a6c6f9d
      https://github.com/WebKit/WebKit/commit/fc01b4369ae0acd8cdda47914bd506df0a6c6f9d
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/graphics/ImageBuffer.cpp
    M Source/WebCore/platform/graphics/ImageBuffer.h
    A Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.cpp
    A Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
    M Source/WebKit/Sources.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    A Source/WebKit/WebProcess/GPU/graphics/ImageBufferRemoteDisplayListBackend.cpp
    A Source/WebKit/WebProcess/GPU/graphics/ImageBufferRemoteDisplayListBackend.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferSetProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
    M Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  [Site isolation] Record the page snapshotting to a DisplayList before sinking it to a PDFDocument
https://bugs.webkit.org/show_bug.cgi?id=285726#
rdar://142664977

Reviewed by Matt Woodrow.

Introduce ImageBufferDisplayListBackend and ImageBufferRemoteDisplayListBackend
to support recording the snapshot to a DisplayList.

Make drawRemoteToPDF() creates a ImageBufferRemoteDisplayListBackend. Its GPUProcess
twin ImageBufferDisplayListBackend will record the drawing commands into a
DisplayList.

Make didDrawRemoteToPDF() calls sinkIntoPDFDocument() on the main thread because
DisplayList::Replayer needs a ControlFactory and ControlFactory::shared() has to
be called on the main thread. Then send the result SharedBuffer to the UIProcess.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::sinkIntoPDFDocument):
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.cpp: Added.
(WebCore::ImageBufferDisplayListBackend::create):
(WebCore::ImageBufferDisplayListBackend::ImageBufferDisplayListBackend):
(WebCore::ImageBufferDisplayListBackend::context):
(WebCore::ImageBufferDisplayListBackend::copyNativeImage):
(WebCore::ImageBufferDisplayListBackend::sinkIntoPDFDocument):
(WebCore::ImageBufferDisplayListBackend::debugDescription const):
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.h: Copied from Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp.
(WebCore::ImageBufferDisplayListBackend::calculateMemoryCost):
* Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp:
(WebCore::DisplayList::DrawingContext::replayDisplayList):
The PDFDocument has to be generated on the main thread because the main frame
DisplayList will eventually reference other DisplayLists which were created by
different WorkQueues. So clearing the DisplayList, once it is replayed back, will
delete the resources in the ResourceHeap on the main thread. This will fire the
assertion: "Unsafe to ref/deref from different threads". So keep the DisplayList
items till they are deleted by the destructor of DisplayList::DrawingContext.

* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::didDrawRemoteToPDF):
(WebKit::allocateImageBufferInternal):
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferRemoteDisplayListBackend.cpp: Added.
(WebKit::ImageBufferRemoteDisplayListBackend::create):
(WebKit::ImageBufferRemoteDisplayListBackend::ImageBufferRemoteDisplayListBackend):
(WebKit::ImageBufferRemoteDisplayListBackend::~ImageBufferRemoteDisplayListBackend):
(WebKit::ImageBufferRemoteDisplayListBackend::createNativeImageReference):
(WebKit::ImageBufferRemoteDisplayListBackend::debugDescription const):
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferRemoteDisplayListBackend.h: Copied from Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.cpp.
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::didCreateBackend):

(WebKit::RemoteImageBufferProxy::ensureBackend const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferSetProxy.cpp:
(WebKit::RemoteImageBufferSetProxy::sendSync):
Fix unrelated mac-safer-cpp errors. Make these functions make early returns.

* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::createImageBuffer):
* Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::drawRemoteToPDF):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list