Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 403125028b31ca883f4ebac8354ee6533e36ecef https://github.com/WebKit/WebKit/commit/403125028b31ca883f4ebac8354ee6533e36ecef Author: Matt Woodrow <mattwood...@apple.com> Date: 2023-03-31 (Fri, 31 Mar 2023)
Changed paths: M Source/WebCore/css/CSSFontFaceSource.h M Source/WebCore/loader/cache/CachedFont.cpp M Source/WebCore/loader/cache/CachedFont.h M Source/WebCore/platform/graphics/Font.cpp M Source/WebCore/platform/graphics/Font.h M Source/WebCore/platform/graphics/FontCustomPlatformData.h M Source/WebCore/platform/graphics/FontPlatformData.cpp M Source/WebCore/platform/graphics/FontPlatformData.h M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp M Source/WebCore/platform/graphics/coretext/FontCoreText.cpp M Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp M Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp M Source/WebCore/platform/graphics/mac/FontCustomPlatformDataMac.cpp M Source/WebCore/platform/graphics/win/FontCustomPlatformDataWin.cpp M Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp M Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp M Source/WebCore/workers/WorkerFontLoadRequest.h M Source/WebKit/GPUProcess/graphics/QualifiedResourceHeap.h M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in M Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp M Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h M Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm M Source/WebKit/Shared/WebCoreArgumentCoders.cpp M Source/WebKit/Shared/WebCoreArgumentCoders.h M Source/WebKit/Shared/cf/ArgumentCodersCF.cpp M Source/WebKit/Shared/playstation/WebCoreArgumentCodersPlayStation.cpp M Source/WebKit/Shared/soup/WebCoreArgumentCodersSoup.cpp M Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h M Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp M Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h Log Message: ----------- Make RemoteRenderingData::cacheFont reconstruct a Font using Attributes, and a reference to FontCustomPlatformData. https://bugs.webkit.org/show_bug.cgi?id=254490 <rdar://106965215> Reviewed by Myles C. Maxfield. Make FontCustomPlatformData refcounted, and owned by the FontPlatformData instead of CreationData We currently only have the CreationData accessible from Font, but when serializing a web font, we need the FontCustomPlatformData in order to share the parsed font data. This just makes the FontCustomPlatformData the shared object on FontPlatformData, and we can still access the CreationData through it. * Source/WebCore/css/CSSFontFaceSource.h: * Source/WebCore/loader/cache/CachedFont.cpp: (WebCore::CachedFont::createCustomFontData): * Source/WebCore/loader/cache/CachedFont.h: * Source/WebCore/platform/graphics/FontCustomPlatformData.h: (WebCore::FontCustomPlatformData::FontCustomPlatformData): * Source/WebCore/platform/graphics/FontPlatformData.cpp: (WebCore::FontPlatformData::FontPlatformData): (WebCore::FontPlatformData::creationData const): * Source/WebCore/platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::customPlatformData const): (WebCore::FontPlatformData::creationData const): Deleted. * Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFallbackForCharacters): * Source/WebCore/platform/graphics/coretext/FontCoreText.cpp: (WebCore::createDerivativeFont): (WebCore::Font::createFontWithoutSynthesizableFeatures const): (WebCore::Font::platformCreateScaledFont const): * Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp: (WebCore::FontPlatformData::FontPlatformData): * Source/WebCore/platform/graphics/mac/FontCustomPlatformDataMac.cpp: (WebCore::FontCustomPlatformData::fontPlatformData): (WebCore::createFontCustomPlatformData): (WebCore::FontCustomPlatformData::creationData const): * Source/WebCore/workers/WorkerFontLoadRequest.h: * Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::Font>::decodePlatformData): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: * Source/WebKit/Shared/WebCoreArgumentCoders.h: Move POD serializable subset of Font into Attributes object In order to serialize a Font where the FontCustomPlatformData is already cached, we want to send the identifier of the data, plus the serialized remainder of the font. This creates an Attributes inner class for Font, containing the data needed to serialize the font, without the platform data. * Source/WebCore/platform/graphics/Font.cpp: (WebCore::Font::Font): (WebCore::Font::renderingResourceIdentifier const): * Source/WebCore/platform/graphics/Font.h: (WebCore::Font::isTextOrientationFallback const): (WebCore::Font::origin const): (WebCore::Font::isInterstitial const): (WebCore::Font::visibility const): (WebCore::Font::attributes const): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::Font>::encode): (IPC::ArgumentCoder<Font>::decode): (IPC::ArgumentCoder<WebCore::Font::Attributes>::encode): (IPC::ArgumentCoder<Font::Attributes>::decode): * Source/WebKit/Shared/WebCoreArgumentCoders.h: Add serialization and RemoteResourceCache support for FontCustomPlatformData This lets us cache FontCustomPlatformData objects independently of Font, so that we can share them between Font instances in the GPUP. * Source/WebKit/GPUProcess/graphics/QualifiedResourceHeap.h: (WebKit::QualifiedResourceHeap::add): (WebKit::QualifiedResourceHeap::getFontCustomPlatformData const): (WebKit::QualifiedResourceHeap::removeFontCustomPlatformData): (WebKit::QualifiedResourceHeap::releaseAllResources): (WebKit::QualifiedResourceHeap::checkInvariants const): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheFontCustomPlatformData): (WebKit::RemoteRenderingBackend::cacheFontCustomPlatformDataWithQualifiedIdentifier): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h: * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheFontCustomPlatformData): (WebKit::RemoteResourceCache::cachedFontCustomPlatformData const): (WebKit::RemoteResourceCache::releaseRenderingResource): * Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h: * Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::encodePlatformData): (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::decodePlatformData): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::encode): (IPC::ArgumentCoder<FontCustomPlatformData>::decode): * Source/WebKit/Shared/WebCoreArgumentCoders.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheFontCustomPlatformData): * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::recordFontCustomPlatformDataUse): (WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate): (WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts): * Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: Add serialization and RemoteResourceCache support for FontCustomPlatformData This lets us cache FontCustomPlatformData objects independently of Font, so that we can share them between Font instances in the GPUP. * Source/WebKit/GPUProcess/graphics/QualifiedResourceHeap.h: (WebKit::QualifiedResourceHeap::add): (WebKit::QualifiedResourceHeap::getFontCustomPlatformData const): (WebKit::QualifiedResourceHeap::removeFontCustomPlatformData): (WebKit::QualifiedResourceHeap::releaseAllResources): (WebKit::QualifiedResourceHeap::checkInvariants const): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheFontCustomPlatformData): (WebKit::RemoteRenderingBackend::cacheFontCustomPlatformDataWithQualifiedIdentifier): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h: * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp: (WebKit::RemoteResourceCache::cacheFontCustomPlatformData): (WebKit::RemoteResourceCache::cachedFontCustomPlatformData const): (WebKit::RemoteResourceCache::releaseRenderingResource): * Source/WebKit/GPUProcess/graphics/RemoteResourceCache.h: * Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::encodePlatformData): (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::decodePlatformData): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::FontCustomPlatformData>::encode): (IPC::ArgumentCoder<FontCustomPlatformData>::decode): * Source/WebKit/Shared/WebCoreArgumentCoders.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheFontCustomPlatformData): * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::recordFontCustomPlatformDataUse): (WebKit::RemoteResourceCacheProxy::prepareForNextRenderingUpdate): (WebKit::RemoteResourceCacheProxy::finalizeRenderingUpdateForFonts): * Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.h: Add FontPlatformData::Attributes for the POD serializable subset. Similar to adding Font::Attributes, this adds FontPlatformData::Attributes for the serializable data, that can be combined with an (optional) FontCustomPlatformData in order to create a final object. Unfortunately this can't actually be used as the main storage within FontPlatformData, as we need to do some data conversion before serialization (and the equivalent conversion on deserialization can't be done without the FontCustomPlatformData). * Source/WebCore/platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::Attributes::Attributes): * Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp: (WebCore::findFontDescriptor): (WebCore::createCTFont): (WebCore::FontPlatformData::create): (WebCore::FontPlatformData::attributes const): * Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::encodePlatformData): (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::decodePlatformData): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::encode): (IPC::ArgumentCoder<FontPlatformData::Attributes>::decode): * Source/WebKit/Shared/WebCoreArgumentCoders.h: * Source/WebKit/Shared/cf/ArgumentCodersCF.cpp: (IPC::ArgumentCoder<CFStringRef>::encode): (IPC::ArgumentCoder<RetainPtr<CFStringRef>>::decode): Add FontPlatformData::Attributes for the POD serializable subset. Similar to adding Font::Attributes, this adds FontPlatformData::Attributes for the serializable data, that can be combined with an (optional) FontCustomPlatformData in order to create a final object. Unfortunately this can't actually be used as the main storage within FontPlatformData, as we need to do some data conversion before serialization (and the equivalent conversion on deserialization can't be done without the FontCustomPlatformData). * Source/WebCore/platform/graphics/FontPlatformData.h: (WebCore::FontPlatformData::Attributes::Attributes): * Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp: (WebCore::findFontDescriptor): (WebCore::createCTFont): (WebCore::FontPlatformData::create): (WebCore::FontPlatformData::attributes const): * Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::encodePlatformData): (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::decodePlatformData): * Source/WebKit/Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<WebCore::FontPlatformData::Attributes>::encode): (IPC::ArgumentCoder<FontPlatformData::Attributes>::decode): * Source/WebKit/Shared/WebCoreArgumentCoders.h: * Source/WebKit/Shared/cf/ArgumentCodersCF.cpp: (IPC::ArgumentCoder<CFStringRef>::encode): (IPC::ArgumentCoder<RetainPtr<CFStringRef>>::decode): Make RemoteRenderingData::cacheFont reconstruct a Font using Attributes, and a reference to FontCustomPlatformData. Uses the new infrastructure to serialize a font using the Attributes of the Font and FontPlatformData, plus optionally a reference to an existing cached FontCustomPlatformData. We can then reconstruct a Font instance in the GPU process, using the shared FontCustomPlatformData and avoid re-serializing and parsing the data. * Source/WebCore/platform/graphics/Font.cpp: (WebCore::Font::description const): * Source/WebCore/platform/graphics/Font.h: * Source/WebCore/platform/graphics/FontPlatformData.h: * Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp: * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::RemoteRenderingBackend::cacheFont): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h: * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::cacheFont): * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: * Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp: (WebKit::RemoteResourceCacheProxy::recordFontUse): Canonical link: https://commits.webkit.org/262435@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes