Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5155f7c72205419fc5b0fba81a72e6bcd71f939
      
https://github.com/WebKit/WebKit/commit/c5155f7c72205419fc5b0fba81a72e6bcd71f939
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/Font.cpp
    M Source/WebCore/platform/graphics/FontBase.cpp
    M Source/WebCore/platform/graphics/FontBase.h
    M Source/WebCore/platform/graphics/GraphicsContext.cpp
    M Source/WebCore/platform/graphics/GraphicsContext.h
    M Source/WebCore/platform/graphics/ImageBuffer.cpp
    M Source/WebCore/platform/graphics/ImageBuffer.h
    M Source/WebCore/platform/graphics/ImageBufferBackend.h
    M Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.cpp
    M Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
    M Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h
    M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
    M Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
    M Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h
    A Source/WebKit/GPUProcess/graphics/SharedFont.cpp
    A Source/WebKit/GPUProcess/graphics/SharedFont.h
    M Source/WebKit/Sources.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h

  Log Message:
  -----------
  [GPUProcess] Use ThreadSafe Font objects in GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=323460
rdar://186689596

Reviewed by Cameron McCormack.

Remote snapshotting records each frame's drawing on a variety of backends, but
replay happens entirely on the main thread. Since DisplayList items may 
reference
resources created on the backend thread, sharing a DisplayList with the main
thread requires all referenced resources to be thread-safe. Today, every 
resource
type meets that requirement except Font.

This change closes that gap by introducing SharedFont, a new 
ThreadSafeRefCounted
object derived from FontBase, allowing Fonts to be accessed safely from 
different
backend threads.

With this in place, 317722@main can also be reverted. This change worked around
the non-thread-safe Font by duplicating the Font object on every DrawGlyphs 
call.
Now that Font is thread-safe, that workaround is no longer necessary.

* Source/WebCore/platform/graphics/Font.cpp:
(WebCore::Font::create):
(WebCore::Font::Font):
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawGlyphs):
(WebCore::GraphicsContext::drawGlyphsImmediate):
* Source/WebCore/platform/graphics/GraphicsContext.h:
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::replaceFontsWithRebuildData): Deleted.
(WebCore::ImageBuffer::rebuildFonts): Deleted.
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::replaceFontsWithRebuildData): Deleted.
(WebCore::ImageBufferBackend::rebuildFonts): Deleted.
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.cpp:
(WebCore::ImageBufferDisplayListBackend::replaceFontsWithRebuildData): Deleted.
(WebCore::ImageBufferDisplayListBackend::rebuildFonts): Deleted.
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawGlyphs::apply const):
(WebCore::DisplayList::DrawDisplayList::setDisplayList): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawGlyphs::DrawGlyphs):
(WebCore::DisplayList::DrawGlyphs::font const): Deleted.
(WebCore::DisplayList::DrawGlyphs::replaceFontWithRebuildData): Deleted.
(WebCore::DisplayList::DrawGlyphs::rebuildFont): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::drawGlyphsImmediate):
(WebCore::DisplayList::displayListWithFontsReplacedByRebuildData): Deleted.
(WebCore::DisplayList::displayListWithFontsRebuilt): Deleted.
(WebCore::DisplayList::replaceFontsWithRebuildDataInItems): Deleted.
(WebCore::DisplayList::rebuildFontsInItems): Deleted.
(WebCore::DisplayList::RecorderImpl::replaceFontsWithRebuildData): Deleted.
(WebCore::DisplayList::RecorderImpl::rebuildFonts): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp:
(WebKit::RemoteGraphicsContext::drawGlyphs):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::moveToSerializedBuffer):
(WebKit::RemoteRenderingBackend::moveToImageBuffer):
(WebKit::RemoteRenderingBackend::cacheFont):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h:
* Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
* Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.cpp:
(WebKit::RemoteGraphicsContextProxy::drawGlyphsImmediate):
(WebKit::RemoteGraphicsContextProxy::recordResourceUse):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::recordFontUse):
* Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
* Source/WebCore/platform/graphics/FontBase.cpp:
(WebCore::FontBase::platformVerticalDataInit):
* Source/WebCore/platform/graphics/FontBase.h:
* Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack):
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/GPUProcess/graphics/SharedFont.cpp: Added.
(WebKit::SharedFont::create):
(WebKit::SharedFont::SharedFont):
* Source/WebKit/GPUProcess/graphics/SharedFont.h: Added.

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



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

Reply via email to