Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design an intentional way to invalidate platform font caches
https://bugs.webkit.org/show_bug.cgi?id=241537 Reviewed by Cameron McCormack and Simon Fraser. Our platform font invalidation code is fairly spotty - the choice of "what invalidates what" isn't particularly deliberate. This patch reorganizes our platform font invalidation code to have this design (where the arrows represent "A calls B" relationships): FontCache::invalidateAllFontCaches() || || || V FontCache::invalidate() || \\ || \\ || ===== || \\ || V || SystemFontDatabase::invalidate() V || FontCache::platformInvalidate() || || || V SystemFontDatabase::platformInvalidate() So now, there is one clear place that should be called whenever this stuff needs to be invalidated: FontCache::invalidateAllFontCaches(). This greatly simplifies the calculus of "which invalidation function do I need to run in which situations." Also, because these invalidation functions are only called during situations like the memory pressure handler, or when system preferences change, performance isn't a concern here, and it's way more important that the relevant invalidation actually happens than it is to exactly minimize the set of specific things that need to be invalidated in every specific situation. On Cocoa ports, SystemFontDatabase::platformInvalidate() is implemented by SystemFontDatabaseCoreText, which already exists. Also, this patch updates the existing platform notification handlers to call the top level entry point FontCache::invalidateAllFontCaches() as expected. This is a defensive patch. There's no specific bug or change in behavior I'm aiming for; instead I'm just trying to make it more likely that the right thing happens at the right time. I'm also trying to create an infrastructure I can plug into when I implement https://bugs.webkit.org/show_bug.cgi?id=237817. No tests because this is a defensive patch. * Source/WebCore/page/Page.cpp: (WebCore::Page::firstTimeInitialization): * Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm: (WebCore::platformReleaseMemory): * Source/WebCore/platform/graphics/FontCache.cpp: (WebCore::FontCache::invalidate): * Source/WebCore/platform/graphics/FontCache.h: (WebCore::FontCache::generation const): * Source/WebCore/platform/graphics/SystemFontDatabase.cpp: (WebCore::SystemFontDatabase::invalidate): (WebCore::SystemFontDatabase::clear): Deleted. * Source/WebCore/platform/graphics/SystemFontDatabase.h: * Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::fontCacheRegisteredFontsChangedNotificationCallback): (WebCore::FontCache::platformInvalidate): (WebCore::invalidateFontCache): Deleted. * Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: (WebCore::SystemFontDatabase::platformInvalidate): (WebCore::SystemFontDatabaseCoreText::clear): * Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h: * Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp: (WebCore::FontCache::platformInvalidate): * Source/WebCore/platform/graphics/gtk/SystemFontDatabaseGTK.cpp: (WebCore::SystemFontDatabase::platformInvalidate): * Source/WebCore/platform/graphics/playstation/SystemFontDatabasePlayStation.cpp: (WebCore::SystemFontDatabase::platformInvalidate): * Source/WebCore/platform/graphics/win/FontCacheWin.cpp: (WebCore::FontCache::platformInvalidate): * Source/WebCore/platform/graphics/win/SystemFontDatabaseWin.cpp: (WebCore::SystemFontDatabase::platformInvalidate): * Source/WebCore/platform/graphics/wpe/SystemFontDatabaseWPE.cpp: (WebCore::SystemFontDatabase::platformInvalidate): * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::contentSizeCategoryDidChange): * Source/WebKit/WebProcess/WebProcess.cpp: (WebKit::WebProcess::terminate): * Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::accessibilityPreferencesDidChange): Canonical link: https://commits.webkit.org/251845@main
- Loading branch information
Showing
18 changed files
with
82 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters