Changeset 286625 in webkit
- Timestamp:
- Dec 7, 2021, 3:33:30 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 40 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/css/CSSFontFace.cpp (modified) (2 diffs)
-
WebCore/css/CSSFontFace.h (modified) (2 diffs)
-
WebCore/css/CSSFontFaceSet.cpp (modified) (1 diff)
-
WebCore/css/CSSFontFaceSource.cpp (modified) (2 diffs)
-
WebCore/css/CSSFontSelector.cpp (modified) (5 diffs)
-
WebCore/css/CSSFontSelector.h (modified) (2 diffs)
-
WebCore/dom/ScriptExecutionContext.cpp (modified) (2 diffs)
-
WebCore/dom/ScriptExecutionContext.h (modified) (2 diffs)
-
WebCore/editing/cocoa/FontAttributeChangesCocoa.mm (modified) (1 diff)
-
WebCore/inspector/agents/InspectorCSSAgent.cpp (modified) (1 diff)
-
WebCore/page/MemoryRelease.cpp (modified) (1 diff)
-
WebCore/page/ProcessWarming.cpp (modified) (2 diffs)
-
WebCore/page/SettingsBase.cpp (modified) (1 diff)
-
WebCore/platform/ThreadGlobalData.cpp (modified) (3 diffs)
-
WebCore/platform/ThreadGlobalData.h (modified) (9 diffs)
-
WebCore/platform/graphics/Font.cpp (modified) (6 diffs)
-
WebCore/platform/graphics/Font.h (modified) (3 diffs)
-
WebCore/platform/graphics/FontCache.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/FontCache.h (modified) (4 diffs)
-
WebCore/platform/graphics/FontCascade.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/FontCascadeFonts.cpp (modified) (6 diffs)
-
WebCore/platform/graphics/FontSelector.h (modified) (1 diff)
-
WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (modified) (1 diff)
-
WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp (modified) (1 diff)
-
WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp (modified) (1 diff)
-
WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (modified) (1 diff)
-
WebCore/platform/graphics/win/FontCacheWin.cpp (modified) (3 diffs)
-
WebCore/testing/InternalSettings.cpp (modified) (2 diffs)
-
WebCore/testing/Internals.cpp (modified) (1 diff)
-
WebCore/workers/WorkerFontLoadRequest.cpp (modified) (1 diff)
-
WebCore/workers/WorkerGlobalScope.cpp (modified) (3 diffs)
-
WebCore/workers/WorkerGlobalScope.h (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebProcess/WebProcess.cpp (modified) (1 diff)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/Misc/WebCoreStatistics.mm (modified) (1 diff)
-
WebKitLegacy/win/ChangeLog (modified) (1 diff)
-
WebKitLegacy/win/WebCoreStatistics.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286603 r286625 1 2021-12-07 Cameron McCormack <heycam@apple.com> 2 3 Move FontCache singleton and instance on WorkerGlobalScope to ThreadGlobalData 4 https://bugs.webkit.org/show_bug.cgi?id=233747 5 6 Reviewed by Darin Adler. 7 8 There are various places in font code where we need access to a 9 FontCache instance. Currently we: 10 11 - assume that we're on the main thread and call 12 FontCache::singleton(), or 13 - get a FontCache off WorkerGlobalScope and pass it down (or store it) 14 where it's needed, then pass it to fontCacheFallingBackToSingleton. 15 16 Having to thread through, or store, the FontCache pointer is 17 inconvenient, and there are some places where we don't have access to 18 a FontCache pointer, but we're on a worker, and we call 19 fontCacheFallingBackToSingleton and incorrectly get back the main 20 thread's instance. 21 22 I think it would be cleaner if we moved both the main thread FontCache 23 singleton, and the one stored on a WorkerGlobalScope, to 24 ThreadGlobalData, which is easily globally accessible. Performing a 25 TLS lookup is cheap these days. 26 27 * css/CSSFontFace.h: 28 * css/CSSFontFace.cpp: 29 (WebCore::CSSFontFace::font): 30 (WebCore::CSSFontFace::fontCacheFallingBackToSingleton): 31 Remove fontCacheFallingBackToSingleton and replace calls to it with 32 FontCache::forCurrentThread. 33 34 * css/CSSFontFaceSet.cpp: 35 (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): 36 Replace getting the FontCache from the ScriptExecutionContext with a 37 call to FontCache::forCurrentThread. 38 39 * css/CSSFontFaceSource.cpp: 40 (WebCore::CSSFontFaceSource::load): 41 (WebCore::CSSFontFaceSource::font): 42 * editing/cocoa/FontAttributeChangesCocoa.mm: 43 (WebCore::FontChanges::platformFontFamilyNameForCSS const): 44 * inspector/agents/InspectorCSSAgent.cpp: 45 (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames): 46 * page/MemoryRelease.cpp: 47 (WebCore::releaseNoncriticalMemory): 48 * page/ProcessWarming.cpp: 49 (WebCore::ProcessWarming::prewarmGlobally): 50 (WebCore::ProcessWarming::collectPrewarmInformation): 51 (WebCore::ProcessWarming::prewarmWithInformation): 52 * page/SettingsBase.cpp: 53 (WebCore::invalidateAfterGenericFamilyChange): 54 Replace calls to FontCache::singleton with calls to 55 FontCache::forCurrentThread. 56 57 * css/CSSFontSelector.h: 58 * css/CSSFontSelector.cpp: 59 (WebCore::CSSFontSelector::CSSFontSelector): 60 (WebCore::CSSFontSelector::~CSSFontSelector): 61 (WebCore::CSSFontSelector::fontRangesForFamily): 62 (WebCore::CSSFontSelector::fallbackFontAt): 63 Remove CSSFontSelector::m_fontCache and use 64 FontCache::forCurrentThread instead. For the CSSFontSelector 65 destructor, we call forCurrentThreadIfNotDestroyed since it 66 can run after ThreadGlobalData::destroy has been called for 67 a worker, and we don't want to cause a fresh FontCache object to be 68 created at this point. 69 70 * dom/ScriptExecutionContext.h: 71 * dom/ScriptExecutionContext.cpp: 72 (WebCore::ScriptExecutionContext::fontCache): 73 Remove the FontCache member. 74 75 * platform/ThreadGlobalData.h: 76 (WebCore::ThreadGlobalData::ThreadGlobalData::cachedResourceRequestInitiators): 77 (WebCore::ThreadGlobalData::ThreadGlobalData::eventNames): 78 (WebCore::ThreadGlobalData::ThreadGlobalData::qualifiedNameCache): 79 (WebCore::ThreadGlobalData::ThreadGlobalData::mimeTypeRegistryThreadGlobalData): 80 (WebCore::ThreadGlobalData::ThreadGlobalData::fontCache): 81 (WebCore::ThreadGlobalData::ThreadGlobalData::fontCacheIfNotDestroyed): 82 * platform/ThreadGlobalData.cpp: 83 (WebCore::ThreadGlobalData::destroy): 84 (WebCore::ThreadGlobalData::initializeFontCache): 85 Add accessors for a lazily created FontCache. Also record whether 86 destroy has been called on the ThreadGlobalData so that 87 fontCacheIfNotDestroyed can check it, and the other lazy object 88 creation methods can assert destroy hasn't been called yet. 89 90 * platform/graphics/Font.h: 91 * platform/graphics/Font.cpp: 92 (WebCore::Font::create): 93 (WebCore::Font::Font): 94 (WebCore::Font::systemFallbackFontForCharacter const): 95 * platform/graphics/FontCache.cpp: 96 (WebCore::FontCache::fontForPlatformData): 97 * workers/WorkerFontLoadRequest.cpp: 98 (WebCore::WorkerFontLoadRequest::createFont): 99 Remove FontCache arguments and use FontCache::forCurrentThread in 100 their place. 101 102 * platform/graphics/FontCache.cpp: 103 (WebCore::FontCache::create): Removed. 104 (WebCore::FontCache::singleton): 105 (WebCore::FontCache::forCurrentThread): 106 Replace FontCache::singleton with FontCache::forCurrentThread, which 107 looks up the FontCache on ThreadGlobalData. 108 (WebCore::FontCache::invalidateAllFontCaches): 109 New function that will in the future invalidate the main thread and 110 all worker thread FontCaches. 111 112 * platform/graphics/FontCache.h: 113 Remove refcounting from FontCache since we no longer need to store a 114 strong reference to it on other objects. 115 (WebCore::FontCache::fontCacheFallingBackToSingleton): Deleted. 116 117 * platform/graphics/FontCascade.cpp: 118 (WebCore::FontCascade::isCurrent const): 119 (WebCore::FontCascade::update const): 120 Call FontCache::forCurrentThread instead of getting it from the 121 FontSelector. 122 123 * platform/graphics/FontCascadeFonts.cpp: 124 (WebCore::FontCascadeFonts::FontCascadeFonts): 125 (WebCore::realizeNextFallback): 126 (WebCore::FontCascadeFonts::realizeFallbackRangesAt): 127 (WebCore::FontCascadeFonts::glyphDataForSystemFallback): 128 * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: 129 (WebCore::FontCascade::fontForCombiningCharacterSequence const): 130 Use FontCache::forCurrentThread. 131 132 * platform/graphics/FontSelector.h: 133 Remove fontCache method. 134 135 * platform/graphics/cocoa/FontCacheCoreText.cpp: 136 (WebCore::fontCacheRegisteredFontsChangedNotificationCallback): 137 (WebCore::fontWithFamilySpecialCase): 138 (WebCore::FontCache::prewarmGlobally): 139 * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: 140 (WebCore::FontFamilySpecificationCoreText::fontRanges const): 141 * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: 142 (WebCore::SystemFontDatabaseCoreText::systemFontParameters): 143 * platform/graphics/mac/ComplexTextControllerCoreText.mm: 144 (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 145 * testing/InternalSettings.cpp: 146 (WebCore::InternalSettings::Backup::restoreTo): 147 (WebCore::InternalSettings::setShouldMockBoldSystemFontForAccessibility): 148 Use FontCache::forCurrentThread. 149 150 * platform/graphics/cocoa/FontCacheCoreText.cpp: 151 (WebCore::invalidateFontCache): 152 * testing/Internals.cpp: 153 (WebCore::Internals::invalidateFontCache): 154 Call the new FontCache::invalidateAllFontCaches. 155 156 * platform/graphics/win/FontCacheWin.cpp: 157 (WebCore::getCJKCodePageMasks): 158 (WebCore::FontCache::systemFallbackForCharacters): 159 Use the FontCache instance we have access to rather than call 160 FontCache::singleton. 161 162 * workers/WorkerGlobalScope.h: 163 * workers/WorkerGlobalScope.cpp: 164 (WebCore::WorkerGlobalScope::fontCache): 165 Remove the FontCache member and accessor. 166 1 167 2021-12-07 Kyle Piddington <kpiddington@apple.com> 2 168 Roll ANGLE to include upstreamed Metal backend -
trunk/Source/WebCore/css/CSSFontFace.cpp
r284057 r286625 397 397 } 398 398 399 FontCache& CSSFontFace::fontCacheFallingBackToSingleton()400 {401 if (m_wrapper && m_wrapper->scriptExecutionContext())402 return m_wrapper->scriptExecutionContext()->fontCache();403 return FontCache::singleton();404 }405 406 399 bool CSSFontFace::computeFailureState() const 407 400 { … … 677 670 case CSSFontFaceSource::Status::Pending: 678 671 case CSSFontFaceSource::Status::Loading: { 679 auto& fontCache = fontCacheFallingBackToSingleton();680 672 Font::Visibility visibility = WebCore::visibility(status(), fontLoadTiming()); 681 return Font::create( fontCache.lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, &fontCache, Font::Interstitial::Yes, visibility);673 return Font::create(FontCache::forCurrentThread().lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, Font::Interstitial::Yes, visibility); 682 674 } 683 675 case CSSFontFaceSource::Status::Success: { -
trunk/Source/WebCore/css/CSSFontFace.h
r283210 r286625 47 47 class CSSValue; 48 48 class CSSValueList; 49 class FontCache;50 49 class FontCreationContext; 51 50 class FontDescription; … … 175 174 176 175 Document* document(); 177 FontCache& fontCacheFallingBackToSingleton();178 176 179 177 RefPtr<CSSValueList> m_families; -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r284057 r286625 120 120 return; 121 121 AllowUserInstalledFonts allowUserInstalledFonts = m_owningFontSelector->scriptExecutionContext()->settingsValues().shouldAllowUserInstalledFonts ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No; 122 Vector<FontSelectionCapabilities> capabilities = m_owningFontSelector->scriptExecutionContext()->fontCache().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);122 Vector<FontSelectionCapabilities> capabilities = FontCache::forCurrentThread().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts); 123 123 if (capabilities.isEmpty()) 124 124 return; -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r284057 r286625 188 188 fontDescription.setComputedSize(1); 189 189 fontDescription.setShouldAllowUserInstalledFonts(m_face.allowUserInstalledFonts()); 190 success = FontCache:: singleton().fontForFamily(fontDescription, m_familyNameOrURI, { }, true);190 success = FontCache::forCurrentThread().fontForFamily(fontDescription, m_familyNameOrURI, { }, true); 191 191 if (document && RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) 192 192 ResourceLoadObserver::shared().logFontLoad(*document, m_familyNameOrURI.string(), success); … … 211 211 // We're local. Just return a Font from the normal cache. 212 212 // We don't want to check alternate font family names here, so pass true as the checkingAlternateName parameter. 213 return FontCache:: singleton().fontForFamily(fontDescription, m_familyNameOrURI, fontCreationContext, true);213 return FontCache::forCurrentThread().fontForFamily(fontDescription, m_familyNameOrURI, fontCreationContext, true); 214 214 } 215 215 -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r284057 r286625 66 66 : ActiveDOMObject(&context) 67 67 , m_context(context) 68 , m_fontCache(context.fontCache())69 68 , m_cssFontFaceSet(CSSFontFaceSet::create(this)) 70 69 , m_fontModifiedObserver([this] { fontModified(); }) … … 82 81 } 83 82 84 m_fontCache->addClient(*this);83 FontCache::forCurrentThread().addClient(*this); 85 84 m_cssFontFaceSet->addFontModifiedObserver(m_fontModifiedObserver); 86 85 LOG(Fonts, "CSSFontSelector %p ctor", this); … … 94 93 95 94 clearFonts(); 96 m_fontCache->removeClient(*this); 95 96 if (auto fontCache = FontCache::forCurrentThreadIfNotDestroyed()) 97 fontCache->removeClient(*this); 97 98 } 98 99 … … 360 361 if (!resolveGenericFamilyFirst) 361 362 resolveAndAssignGenericFamily(); 362 auto font = m_fontCache->fontForFamily(*fontDescriptionForLookup, familyForLookup, { { }, { }, fontPaletteValues });363 auto font = FontCache::forCurrentThread().fontForFamily(*fontDescriptionForLookup, familyForLookup, { { }, { }, fontPaletteValues }); 363 364 if (document && RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) 364 365 ResourceLoadObserver::shared().logFontLoad(*document, familyForLookup.string(), !!font); … … 391 392 return nullptr; 392 393 auto& pictographFontFamily = m_context->settingsValues().fontGenericFamilies.pictographFontFamily(); 393 auto font = m_fontCache->fontForFamily(fontDescription, pictographFontFamily);394 auto font = FontCache::forCurrentThread().fontForFamily(fontDescription, pictographFontFamily); 394 395 if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled() && is<Document>(m_context)) 395 396 ResourceLoadObserver::shared().logFontLoad(downcast<Document>(*m_context), pictographFontFamily, !!font); -
trunk/Source/WebCore/css/CSSFontSelector.h
r284857 r286625 73 73 void addFontPaletteValuesRule(StyleRuleFontPaletteValues&); 74 74 75 FontCache& fontCache() const final { return m_fontCache.get(); }76 75 void fontCacheInvalidated() final; 77 76 … … 124 123 125 124 WeakPtr<ScriptExecutionContext> m_context; 126 Ref<FontCache> m_fontCache;127 125 RefPtr<FontFaceSet> m_fontFaceSet; 128 126 Ref<CSSFontFaceSet> m_cssFontFaceSet; -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r286025 r286625 38 38 #include "Document.h" 39 39 #include "ErrorEvent.h" 40 #include "FontCache.h"41 40 #include "FontLoadRequest.h" 42 41 #include "JSDOMExceptionHandling.h" … … 224 223 } 225 224 226 FontCache& ScriptExecutionContext::fontCache()227 {228 return FontCache::singleton();229 }230 231 225 CSSValuePool& ScriptExecutionContext::cssValuePool() 232 226 { -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r286025 r286625 67 67 class EventLoopTaskGroup; 68 68 class EventTarget; 69 class FontCache;70 69 class FontLoadRequest; 71 70 class MessagePort; … … 169 168 virtual void didLoadResourceSynchronously(const URL&); 170 169 171 virtual FontCache& fontCache();172 170 virtual CSSFontSelector* cssFontSelector() { return nullptr; } 173 171 virtual CSSValuePool& cssValuePool(); -
trunk/Source/WebCore/editing/cocoa/FontAttributeChangesCocoa.mm
r278185 r286625 49 49 description.setIsItalic(m_italic.value_or(false)); 50 50 description.setWeight(FontSelectionValue { m_bold.value_or(false) ? 900 : 500 }); 51 if (auto font = FontCache:: singleton().fontForFamily(description, m_fontFamily))51 if (auto font = FontCache::forCurrentThread().fontForFamily(description, m_fontFamily)) 52 52 fontNameFromDescription = adoptCF(CTFontCopyPostScriptName(font->getCTFont())); 53 53 -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
r285552 r286625 898 898 auto fontFamilyNames = JSON::ArrayOf<String>::create(); 899 899 900 Vector<String> systemFontFamilies = FontCache:: singleton().systemFontFamilies();900 Vector<String> systemFontFamilies = FontCache::forCurrentThread().systemFontFamilies(); 901 901 for (const auto& familyName : systemFontFamilies) 902 902 fontFamilyNames->addItem(familyName); -
trunk/Source/WebCore/page/MemoryRelease.cpp
r285648 r286625 71 71 RenderTheme::singleton().purgeCaches(); 72 72 73 FontCache::singleton().purgeInactiveFontData(); 74 FontCache::singleton().clearWidthCaches(); 73 // FIXME: Clear these font caches in workers too? 74 FontCache::forCurrentThread().purgeInactiveFontData(); 75 FontCache::forCurrentThread().clearWidthCaches(); 75 76 76 77 TextPainter::clearGlyphDisplayLists(); -
trunk/Source/WebCore/page/ProcessWarming.cpp
r285141 r286625 74 74 75 75 // Prewarm font cache 76 FontCache:: singleton().prewarmGlobally();76 FontCache::prewarmGlobally(); 77 77 78 78 #if ENABLE(TELEPHONE_NUMBER_DETECTION) … … 87 87 WebCore::PrewarmInformation ProcessWarming::collectPrewarmInformation() 88 88 { 89 return { FontCache:: singleton().collectPrewarmInformation() };89 return { FontCache::forCurrentThread().collectPrewarmInformation() }; 90 90 } 91 91 92 92 void ProcessWarming::prewarmWithInformation(const PrewarmInformation& prewarmInfo) 93 93 { 94 FontCache:: singleton().prewarm(prewarmInfo.fontCache);94 FontCache::forCurrentThread().prewarm(prewarmInfo.fontCache); 95 95 } 96 96 -
trunk/Source/WebCore/page/SettingsBase.cpp
r286543 r286625 58 58 static void invalidateAfterGenericFamilyChange(Page* page) 59 59 { 60 FontCache::singleton().invalidateFontCascadeCache(); 60 // No need to invalidate FontCascadeCaches in worker threads, since workers 61 // do not respond to changes in Settings values. 62 FontCache::forCurrentThread().invalidateFontCascadeCache(); 63 61 64 if (page) 62 65 page->setNeedsRecalcStyleInAllFrames(); -
trunk/Source/WebCore/platform/ThreadGlobalData.cpp
r274705 r286625 30 30 #include "CachedResourceRequestInitiators.h" 31 31 #include "EventNames.h" 32 #include "FontCache.h" 32 33 #include "MIMETypeRegistry.h" 33 34 #include "QualifiedNameCache.h" … … 59 60 void ThreadGlobalData::destroy() 60 61 { 62 m_destroyed = true; 63 61 64 m_cachedConverterICU = nullptr; 62 65 66 // The ThreadGlobalData destructor is called under the TLS destruction 67 // callback, which is later than when the static atom table is destroyed. 68 // To avoid AtomStrings being destroyed after the table, we clear objects 69 // that have AtomStrings in them. 63 70 m_eventNames = nullptr; 64 71 m_threadTimers = nullptr; 65 72 m_qualifiedNameCache = nullptr; 73 m_fontCache = nullptr; 66 74 } 67 75 … … 140 148 } 141 149 150 void ThreadGlobalData::initializeFontCache() 151 { 152 ASSERT(!m_fontCache); 153 m_fontCache = makeUnique<FontCache>(); 154 } 155 142 156 } // namespace WebCore -
trunk/Source/WebCore/platform/ThreadGlobalData.h
r274705 r286625 38 38 namespace WebCore { 39 39 40 class FontCache; 40 41 class QualifiedNameCache; 41 42 class ThreadTimers; … … 60 61 const CachedResourceRequestInitiators& cachedResourceRequestInitiators() 61 62 { 63 ASSERT(!m_destroyed); 62 64 if (UNLIKELY(!m_cachedResourceRequestInitiators)) 63 65 initializeCachedResourceRequestInitiators(); … … 66 68 EventNames& eventNames() 67 69 { 70 ASSERT(!m_destroyed); 68 71 if (UNLIKELY(!m_eventNames)) 69 72 initializeEventNames(); … … 72 75 QualifiedNameCache& qualifiedNameCache() 73 76 { 77 ASSERT(!m_destroyed); 74 78 if (UNLIKELY(!m_qualifiedNameCache)) 75 79 initializeQualifiedNameCache(); … … 78 82 const MIMETypeRegistryThreadGlobalData& mimeTypeRegistryThreadGlobalData() 79 83 { 84 ASSERT(!m_destroyed); 80 85 if (UNLIKELY(!m_MIMETypeRegistryThreadGlobalData)) 81 86 initializeMimeTypeRegistryThreadGlobalData(); … … 96 101 void setIsInRemoveAllEventListeners(bool value) { m_isInRemoveAllEventListeners = value; } 97 102 103 FontCache& fontCache() 104 { 105 ASSERT(!m_destroyed); 106 if (UNLIKELY(!m_fontCache)) 107 initializeFontCache(); 108 return *m_fontCache; 109 } 110 111 FontCache* fontCacheIfNotDestroyed() { return m_destroyed ? nullptr : &fontCache(); } 112 98 113 private: 99 114 WEBCORE_EXPORT void initializeCachedResourceRequestInitiators(); … … 101 116 WEBCORE_EXPORT void initializeQualifiedNameCache(); 102 117 WEBCORE_EXPORT void initializeMimeTypeRegistryThreadGlobalData(); 118 WEBCORE_EXPORT void initializeFontCache(); 103 119 104 120 std::unique_ptr<CachedResourceRequestInitiators> m_cachedResourceRequestInitiators; … … 109 125 std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU; 110 126 std::unique_ptr<MIMETypeRegistryThreadGlobalData> m_MIMETypeRegistryThreadGlobalData; 127 std::unique_ptr<FontCache> m_fontCache; 111 128 112 129 #ifndef NDEBUG … … 115 132 116 133 bool m_isInRemoveAllEventListeners { false }; 134 bool m_destroyed { false }; 117 135 118 136 WEBCORE_EXPORT friend ThreadGlobalData& threadGlobalData(); -
trunk/Source/WebCore/platform/graphics/Font.cpp
r283279 r286625 61 61 Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, std::optional<RenderingResourceIdentifier> identifier) 62 62 { 63 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, nullptr)); 64 } 65 66 Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, FontCache* fontCacheForVerticalData, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, std::optional<RenderingResourceIdentifier> identifier) 67 { 68 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, fontCacheForVerticalData)); 69 } 70 71 Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* fontCacheForVerticalData) 63 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier)); 64 } 65 66 Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic) 72 67 { 73 68 bool wrapping; … … 77 72 // FIXME: Why doesn't this pass in any meaningful data for the last few arguments? 78 73 auto platformData = CachedFont::platformDataFromCustomData(*customFontData, description, syntheticBold, syntheticItalic, { }); 79 return Font::create(WTFMove(platformData), origin , fontCacheForVerticalData);80 } 81 82 Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, std::optional<RenderingResourceIdentifier> renderingResourceIdentifier , FontCache* fontCacheForVerticalData)74 return Font::create(WTFMove(platformData), origin); 75 } 76 77 Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, std::optional<RenderingResourceIdentifier> renderingResourceIdentifier) 83 78 : m_platformData(platformData) 84 79 , m_renderingResourceIdentifier(renderingResourceIdentifier) … … 101 96 #if ENABLE(OPENTYPE_VERTICAL) 102 97 if (platformData.orientation() == FontOrientation::Vertical && orientationFallback == OrientationFallback::No) { 103 m_verticalData = fontCacheForVerticalData ? fontCacheForVerticalData->verticalData(platformData) : FontCache::singleton().verticalData(platformData);98 m_verticalData = FontCache::forCurrentThread().verticalData(platformData); 104 99 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVerticalMetrics(); 105 100 } 106 #else107 UNUSED_PARAM(fontCacheForVerticalData);108 101 #endif 109 102 } … … 597 590 } 598 591 599 RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont , FontCache& fontCache) const592 RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont) const 600 593 { 601 594 auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap()); … … 603 596 if (!character) { 604 597 UChar codeUnit = 0; 605 return fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1);598 return FontCache::forCurrentThread().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1); 606 599 } 607 600 … … 618 611 codeUnitsLength = 2; 619 612 } 620 auto font = fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get();613 auto font = FontCache::forCurrentThread().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get(); 621 614 if (font) 622 615 font->m_isUsedInSystemFallbackCache = true; -
trunk/Source/WebCore/platform/graphics/Font.h
r283971 r286625 82 82 enum class Visibility : bool { Visible, Invisible }; 83 83 enum class OrientationFallback : bool { No, Yes }; 84 WEBCORE_EXPORT static Ref<Font> create(const FontPlatformData&, Origin = Origin::Local, Interstitial = Interstitial::No, 85 Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, std::optional<RenderingResourceIdentifier> = std::nullopt); 86 static Ref<Font> create(const FontPlatformData&, Origin, FontCache* fontCacheForVerticalData, Interstitial = Interstitial::No, 87 Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, std::optional<RenderingResourceIdentifier> = std::nullopt); 88 WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* = nullptr); 84 WEBCORE_EXPORT static Ref<Font> create(const FontPlatformData&, Origin = Origin::Local, Interstitial = Interstitial::No, Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, std::optional<RenderingResourceIdentifier> = std::nullopt); 85 WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic); 89 86 90 87 WEBCORE_EXPORT ~Font(); … … 165 162 bool platformSupportsCodePoint(UChar32, std::optional<UChar32> variation = std::nullopt) const; 166 163 167 RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont , FontCache&) const;164 RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont) const; 168 165 169 166 const GlyphPage* glyphPage(unsigned pageNumber) const; … … 210 207 211 208 private: 212 WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, std::optional<RenderingResourceIdentifier> , FontCache*);209 WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, std::optional<RenderingResourceIdentifier>); 213 210 214 211 void platformInit(); -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r282863 r286625 36 36 #include "FontSelector.h" 37 37 #include "Logging.h" 38 #include "ThreadGlobalData.h" 38 39 #include "WebKitFontFamilyNames.h" 40 #include "WorkerOrWorkletThread.h" 39 41 #include <wtf/HashMap.h> 40 42 #include <wtf/MemoryPressureHandler.h> … … 149 151 }; 150 152 151 Ref<FontCache> FontCache::create() 152 { 153 ASSERT(!isMainThread()); 154 return adoptRef(*new FontCache()); 155 } 156 157 FontCache& FontCache::singleton() 158 { 159 static MainThreadNeverDestroyed<FontCache> globalFontCache; 160 return globalFontCache; 153 FontCache& FontCache::forCurrentThread() 154 { 155 return threadGlobalData().fontCache(); 156 } 157 158 FontCache* FontCache::forCurrentThreadIfNotDestroyed() 159 { 160 return threadGlobalData().fontCacheIfNotDestroyed(); 161 161 } 162 162 … … 282 282 283 283 auto addResult = m_fontDataCaches->data.ensure(platformData, [&] { 284 return Font::create(platformData, Font::Origin::Local , this);284 return Font::create(platformData, Font::Origin::Local); 285 285 }); 286 286 … … 490 490 } 491 491 492 void FontCache::invalidateAllFontCaches() 493 { 494 ASSERT(isMainThread()); 495 496 // FIXME: Invalidate FontCaches in workers too. 497 FontCache::forCurrentThread().invalidate(); 498 } 499 492 500 #if !PLATFORM(COCOA) 493 501 -
trunk/Source/WebCore/platform/graphics/FontCache.h
r284857 r286625 281 281 using FontCascadeCache = HashMap<FontCascadeCacheKey, std::unique_ptr<FontCascadeCacheEntry>, FontCascadeCacheKeyHash, FontCascadeCacheKeyHashTraits>; 282 282 283 class FontCache : public RefCounted<FontCache> { 284 friend class NeverDestroyed<FontCache, MainThreadAccessTraits>; 285 283 class FontCache { 286 284 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; 287 285 public: 288 static Ref<FontCache> create();289 WEBCORE_EXPORT static FontCache& singleton();290 static FontCache& fontCacheFallingBackToSingleton(RefPtr<FontSelector>); 291 286 WEBCORE_EXPORT static FontCache& forCurrentThread(); 287 static FontCache* forCurrentThreadIfNotDestroyed(); 288 289 FontCache(); 292 290 ~FontCache(); 293 291 … … 325 323 unsigned short generation() const { return m_generation; } 326 324 WEBCORE_EXPORT void invalidate(); 325 WEBCORE_EXPORT static void invalidateAllFontCaches(); 327 326 328 327 WEBCORE_EXPORT size_t fontCount(); … … 360 359 PrewarmInformation collectPrewarmInformation() const; 361 360 void prewarm(const PrewarmInformation&); 362 void prewarmGlobally();361 static void prewarmGlobally(); 363 362 364 363 private: 365 FontCache();366 367 364 WEBCORE_EXPORT void purgeInactiveFontDataIfNeeded(); 368 365 void pruneUnreferencedEntriesFromFontCascadeCache(); … … 446 443 } 447 444 448 inline FontCache& FontCache::fontCacheFallingBackToSingleton(RefPtr<FontSelector> fontSelector) 449 { 450 return fontSelector ? fontSelector->fontCache() : FontCache::singleton(); 451 } 452 453 } 445 } -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r284677 r286625 137 137 if (!m_fonts) 138 138 return false; 139 if (m_fonts->generation() != fontSelector.fontCache().generation())139 if (m_fonts->generation() != FontCache::forCurrentThread().generation()) 140 140 return false; 141 141 if (m_fonts->fontSelectorVersion() != fontSelector.version()) … … 155 155 void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const 156 156 { 157 FontCache::fo ntCacheFallingBackToSingleton(fontSelector).updateFontCascade(*this, WTFMove(fontSelector));157 FontCache::forCurrentThread().updateFontCascade(*this, WTFMove(fontSelector)); 158 158 } 159 159 -
trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp
r284016 r286625 103 103 , m_fontSelector(fontSelector) 104 104 , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0) 105 , m_generation(FontCache::fo ntCacheFallingBackToSingleton(m_fontSelector).generation())105 , m_generation(FontCache::forCurrentThread().generation()) 106 106 { 107 107 #if ASSERT_ENABLED … … 114 114 : m_cachedPrimaryFont(nullptr) 115 115 , m_fontSelectorVersion(0) 116 , m_generation(FontCache:: singleton().generation())116 , m_generation(FontCache::forCurrentThread().generation()) 117 117 , m_isForPlatformFont(true) 118 118 { 119 m_realizedFallbackRanges.append(FontRanges(FontCache:: singleton().fontForPlatformData(platformData)));119 m_realizedFallbackRanges.append(FontRanges(FontCache::forCurrentThread().fontForPlatformData(platformData))); 120 120 } 121 121 … … 145 145 ASSERT(index < description.effectiveFamilyCount()); 146 146 147 auto& fontCache = FontCache::fo ntCacheFallingBackToSingleton(fontSelector);147 auto& fontCache = FontCache::forCurrentThread(); 148 148 while (index < description.effectiveFamilyCount()) { 149 149 auto visitor = WTF::makeVisitor([&](const AtomString& family) -> FontRanges { … … 182 182 183 183 ASSERT(index == m_realizedFallbackRanges.size()); 184 ASSERT(FontCache::fo ntCacheFallingBackToSingleton(m_fontSelector).generation() == m_generation);184 ASSERT(FontCache::forCurrentThread().generation() == m_generation); 185 185 186 186 m_realizedFallbackRanges.append(FontRanges()); … … 192 192 fontRanges = m_fontSelector->fontRangesForFamily(description, familyNamesData->at(FamilyNamesIndex::StandardFamily)); 193 193 if (fontRanges.isNull()) 194 fontRanges = FontRanges(FontCache::fo ntCacheFallingBackToSingleton(m_fontSelector).lastResortFallbackFont(description));194 fontRanges = FontRanges(FontCache::forCurrentThread().lastResortFallbackFont(description)); 195 195 return fontRanges; 196 196 } … … 352 352 font = &realizeFallbackRangesAt(description, 0).fontForFirstRange(); 353 353 354 auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No , FontCache::fontCacheFallingBackToSingleton(m_fontSelector));354 auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No); 355 355 if (!systemFallbackFont) 356 356 return GlyphData(); -
trunk/Source/WebCore/platform/graphics/FontSelector.h
r275420 r286625 56 56 virtual void opportunisticallyStartFontDataURLLoading(const FontCascadeDescription&, const AtomString& family) = 0; 57 57 58 virtual FontCache& fontCache() const = 0;59 58 virtual void fontCacheInvalidated() { } 60 59 -
trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
r276450 r286625 139 139 } 140 140 141 if (auto systemFallback = FontCache::fo ntCacheFallingBackToSingleton(fontSelector()).systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) {141 if (auto systemFallback = FontCache::forCurrentThread().systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) { 142 142 if (systemFallback->canRenderCombiningCharacterSequence(characters, length) && (!preferColoredFont || systemFallback->platformData().isColorBitmapFont())) 143 143 return systemFallback.get(); -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r286142 r286625 758 758 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef) 759 759 { 760 ASSERT_UNUSED(observer, observer == &FontCache::singleton());760 ASSERT_UNUSED(observer, isMainThread() && observer == &FontCache::forCurrentThread()); 761 761 762 762 invalidateFontCache(); … … 1250 1250 { 1251 1251 ensureOnMainThread([] { 1252 // FIXME: Workers need to access SystemFontDatabaseCoreText. 1252 1253 SystemFontDatabaseCoreText::singleton().clear(); 1254 // FIXME: Workers need to access FontFamilySpecificationCoreTextCache. 1253 1255 clearFontFamilySpecificationCoreTextCache(); 1254 1256 1257 // FIXME: Workers need to access FontDatabase. 1255 1258 FontDatabase::singletonAllowingUserInstalledFonts().clear(); 1256 1259 FontDatabase::singletonDisallowingUserInstalledFonts().clear(); 1257 1260 1258 FontCache:: singleton().invalidate();1261 FontCache::invalidateAllFontCaches(); 1259 1262 }); 1260 1263 } … … 1288 1291 if (family.startsWith("UICTFontTextStyle")) { 1289 1292 const auto& request = fontDescription.fontSelectionRequest(); 1290 CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) || FontCache:: singleton().shouldMockBoldSystemFontForAccessibility() ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);1293 CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) || FontCache::forCurrentThread().shouldMockBoldSystemFontForAccessibility() ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0); 1291 1294 auto descriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(family.string().createCFString().get(), RenderThemeCocoa::singleton().contentSizeCategory(), fontDescription.computedLocale().string().createCFString().get())); 1292 1295 if (traits) … … 1697 1700 FontCache::PrewarmInformation prewarmInfo; 1698 1701 prewarmInfo.seenFamilies = WTFMove(families); 1699 FontCache:: singleton().prewarm(prewarmInfo);1700 #endif 1701 } 1702 1703 } 1702 FontCache::forCurrentThread().prewarm(prewarmInfo); 1703 #endif 1704 } 1705 1706 } -
trunk/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp
r282863 r286625 107 107 ASSERT(fontPlatformData); 108 108 109 return FontRanges(FontCache:: singleton().fontForPlatformData(*fontPlatformData));109 return FontRanges(FontCache::forCurrentThread().fontForPlatformData(*fontPlatformData)); 110 110 } 111 111 -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
r272700 r286625 250 250 251 251 auto weight = description.weight(); 252 if (FontCache:: singleton().shouldMockBoldSystemFontForAccessibility())252 if (FontCache::forCurrentThread().shouldMockBoldSystemFontForAccessibility()) 253 253 weight = weight + FontSelectionValue(200); 254 254 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
r282973 r286625 243 243 } 244 244 FontPlatformData runFontPlatformData(runCTFont, CTFontGetSize(runCTFont)); 245 runFont = FontCache:: singleton().fontForPlatformData(runFontPlatformData).ptr();245 runFont = FontCache::forCurrentThread().fontForPlatformData(runFontPlatformData).ptr(); 246 246 } 247 247 if (m_fallbackFonts && runFont != &m_font.primaryFont()) -
trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp
r282863 r286625 147 147 } 148 148 149 static const Vector<DWORD, 4>& getCJKCodePageMasks( )149 static const Vector<DWORD, 4>& getCJKCodePageMasks(FontCache& fontCache) 150 150 { 151 151 // The default order in which we look for a font for a CJK character. If the user's default code page is … … 162 162 if (!initialized) { 163 163 initialized = true; 164 IMLangFontLinkType* langFontLink = FontCache::singleton().getFontLinkInterface();164 IMLangFontLinkType* langFontLink = fontCache.getFontLinkInterface(); 165 165 if (!langFontLink) 166 166 return codePageMasks; … … 258 258 // do font linking against a single one of them, preferring the default 259 259 // code page for the user's locale. 260 const Vector<DWORD, 4>& CJKCodePageMasks = getCJKCodePageMasks( );260 const Vector<DWORD, 4>& CJKCodePageMasks = getCJKCodePageMasks(*this); 261 261 unsigned numCodePages = CJKCodePageMasks.size(); 262 262 for (unsigned i = 0; i < numCodePages && !hfont; ++i) { -
trunk/Source/WebCore/testing/InternalSettings.cpp
r286305 r286625 132 132 133 133 RenderTheme::singleton().setShouldMockBoldSystemFontForAccessibility(m_shouldMockBoldSystemFontForAccessibility); 134 FontCache::singleton().setShouldMockBoldSystemFontForAccessibility(m_shouldMockBoldSystemFontForAccessibility); 134 // FIXME: Call setShouldMockBoldSystemFontForAccessibility() on all workers. 135 FontCache::forCurrentThread().setShouldMockBoldSystemFontForAccessibility(m_shouldMockBoldSystemFontForAccessibility); 135 136 136 137 #if ENABLE(WEB_AUDIO) … … 571 572 return Exception { InvalidAccessError }; 572 573 RenderTheme::singleton().setShouldMockBoldSystemFontForAccessibility(requires); 573 FontCache::singleton().setShouldMockBoldSystemFontForAccessibility(requires); 574 // FIXME: Call setShouldMockBoldSystemFontForAccessibility() on all workers. 575 FontCache::forCurrentThread().setShouldMockBoldSystemFontForAccessibility(requires); 574 576 return { }; 575 577 } -
trunk/Source/WebCore/testing/Internals.cpp
r286265 r286625 1853 1853 void Internals::invalidateFontCache() 1854 1854 { 1855 FontCache:: singleton().invalidate();1855 FontCache::invalidateAllFontCaches(); 1856 1856 } 1857 1857 -
trunk/Source/WebCore/workers/WorkerFontLoadRequest.cpp
r284093 r286625 94 94 ASSERT(m_fontCustomPlatformData); 95 95 ASSERT(m_context); 96 return Font::create(m_fontCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontCreationContext), Font::Origin::Remote , &m_context->fontCache());96 return Font::create(m_fontCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontCreationContext), Font::Origin::Remote); 97 97 } 98 98 -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r286414 r286625 35 35 #include "ContentSecurityPolicy.h" 36 36 #include "Crypto.h" 37 #include "FontCache.h"38 37 #include "FontCustomPlatformData.h" 39 38 #include "FontFaceSet.h" … … 69 68 #include <wtf/IsoMallocInlines.h> 70 69 #include <wtf/Lock.h> 70 #include <wtf/WorkQueue.h> 71 71 #include <wtf/threads/BinarySemaphore.h> 72 72 … … 531 531 } 532 532 533 FontCache& WorkerGlobalScope::fontCache()534 {535 if (!m_fontCache)536 m_fontCache = FontCache::create();537 return *m_fontCache;538 }539 540 533 Ref<FontFaceSet> WorkerGlobalScope::fonts() 541 534 { -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r286499 r286625 140 140 CSSValuePool& cssValuePool() final; 141 141 CSSFontSelector* cssFontSelector() final; 142 FontCache& fontCache() final;143 142 Ref<FontFaceSet> fonts(); 144 143 std::unique_ptr<FontLoadRequest> fontLoadRequest(String& url, bool isSVG, bool isInitiatingElementInUserAgentShadowTree, LoadedFromOpaqueSource) final; … … 222 221 std::unique_ptr<CSSValuePool> m_cssValuePool; 223 222 RefPtr<CSSFontSelector> m_cssFontSelector; 224 RefPtr<FontCache> m_fontCache;225 223 ReferrerPolicy m_referrerPolicy; 226 224 Settings::Values m_settingsValues; -
trunk/Source/WebKit/ChangeLog
r286624 r286625 1 2021-12-07 Cameron McCormack <heycam@apple.com> 2 3 Move FontCache singleton and instance on WorkerGlobalScope to ThreadGlobalData 4 https://bugs.webkit.org/show_bug.cgi?id=233747 5 6 Reviewed by Darin Adler. 7 8 * WebProcess/WebProcess.cpp: 9 (WebKit::WebProcess::terminate): 10 Update existing main threa callers of FontCache::singleton() to use 11 FontCache::forCurrentThread(). 12 1 13 2021-12-07 Ben Nham <nham@apple.com> 2 14 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r286455 r286625 869 869 { 870 870 #ifndef NDEBUG 871 // These are done in an attempt to reduce LEAK output. 871 872 GCController::singleton().garbageCollectNow(); 872 FontCache:: singleton().invalidate();873 FontCache::forCurrentThread().invalidate(); 873 874 MemoryCache::singleton().setDisabled(true); 874 875 #endif -
trunk/Source/WebKitLegacy/mac/ChangeLog
r286560 r286625 1 2021-12-07 Cameron McCormack <heycam@apple.com> 2 3 Move FontCache singleton and instance on WorkerGlobalScope to ThreadGlobalData 4 https://bugs.webkit.org/show_bug.cgi?id=233747 5 6 Reviewed by Darin Adler. 7 8 * Misc/WebCoreStatistics.mm: 9 (+[WebCoreStatistics cachedFontDataCount]): 10 (+[WebCoreStatistics cachedFontDataInactiveCount]): 11 (+[WebCoreStatistics purgeInactiveFontData]): 12 Update existing main thread callers of FontCache::singleton() to use 13 FontCache::forCurrentThread(). 14 1 15 2021-12-06 Devin Rousso <drousso@apple.com> 2 16 -
trunk/Source/WebKitLegacy/mac/Misc/WebCoreStatistics.mm
r278062 r286625 141 141 + (size_t)cachedFontDataCount 142 142 { 143 return FontCache:: singleton().fontCount();143 return FontCache::forCurrentThread().fontCount(); 144 144 } 145 145 146 146 + (size_t)cachedFontDataInactiveCount 147 147 { 148 return FontCache:: singleton().inactiveFontCount();148 return FontCache::forCurrentThread().inactiveFontCount(); 149 149 } 150 150 151 151 + (void)purgeInactiveFontData 152 152 { 153 FontCache:: singleton().purgeInactiveFontData();153 FontCache::forCurrentThread().purgeInactiveFontData(); 154 154 } 155 155 -
trunk/Source/WebKitLegacy/win/ChangeLog
r286455 r286625 1 2021-12-07 Cameron McCormack <heycam@apple.com> 2 3 Move FontCache singleton and instance on WorkerGlobalScope to ThreadGlobalData 4 https://bugs.webkit.org/show_bug.cgi?id=233747 5 6 Reviewed by Darin Adler. 7 8 * WebCoreStatistics.cpp: 9 (WebCoreStatistics::cachedFontDataCount): 10 (WebCoreStatistics::cachedFontDataInactiveCount): 11 (WebCoreStatistics::purgeInactiveFontData): 12 Update existing main thread callers of FontCache::singleton() to use 13 FontCache::forCurrentThread(). 14 1 15 2021-12-02 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebKitLegacy/win/WebCoreStatistics.cpp
r251220 r286625 211 211 if (!count) 212 212 return E_POINTER; 213 *count = (UINT) FontCache:: singleton().fontCount();213 *count = (UINT) FontCache::forCurrentThread().fontCount(); 214 214 return S_OK; 215 215 } … … 219 219 if (!count) 220 220 return E_POINTER; 221 *count = (UINT) FontCache:: singleton().inactiveFontCount();221 *count = (UINT) FontCache::forCurrentThread().inactiveFontCount(); 222 222 return S_OK; 223 223 } … … 225 225 HRESULT WebCoreStatistics::purgeInactiveFontData(void) 226 226 { 227 FontCache:: singleton().purgeInactiveFontData();227 FontCache::forCurrentThread().purgeInactiveFontData(); 228 228 return S_OK; 229 229 }
Note:
See TracChangeset
for help on using the changeset viewer.