RESOLVED FIXED233972
Move the SystemFallbackCache to FontCache
https://bugs.webkit.org/show_bug.cgi?id=233972
Summary Move the SystemFallbackCache to FontCache
Cameron McCormack (:heycam)
Reported 2021-12-07 21:59:17 PST
Move the SystemFallbackCache to FontCache
Attachments
Patch (22.59 KB, patch)
2021-12-07 21:59 PST, Cameron McCormack (:heycam)
no flags
Patch (25.23 KB, patch)
2021-12-08 15:24 PST, Cameron McCormack (:heycam)
mmaxfield: review+
Rebased patch (22.58 KB, patch)
2022-05-18 18:51 PDT, Matt Woodrow
no flags
Patch (25.94 KB, patch)
2022-05-18 20:30 PDT, Matt Woodrow
ews-feeder: commit-queue-
Patch (25.99 KB, patch)
2022-07-18 23:33 PDT, Matt Woodrow
no flags
Patch (119.42 KB, patch)
2022-07-18 23:35 PDT, Matt Woodrow
ews-feeder: commit-queue-
Cameron McCormack (:heycam)
Comment 1 2021-12-07 21:59:49 PST
Cameron McCormack (:heycam)
Comment 2 2021-12-08 13:59:40 PST
The Gtk/WPE failures point out that FontCacheFreeType.cpp has its own SystemFallbackCache HashMap, with different key/value types. A bit of abstraction over these will be needed.
Cameron McCormack (:heycam)
Comment 3 2021-12-08 15:07:04 PST
Actually they seem to be doing two slightly different things. The SystemFallbackCache that's in Font.cpp and which I'm moving out to a separate file is a per-character map of Font to the fallback Font to use. The one in FontCacheFreeType.cpp is a cache of FcPatterns and FcFontSets that FontCache::systemFallbackForCharacters uses to avoid the overhead of doing the FcConfigSubstitute calls for the same inputs. So I think for now we should just rename the type used in FontCacheFreeType.cpp, but it's another cache that needs to move to live on the FontCache object so that it can be thread-specific. (Or locking added around it.)
Cameron McCormack (:heycam)
Comment 4 2021-12-08 15:24:26 PST
Myles C. Maxfield
Comment 5 2021-12-08 21:00:55 PST
Comment on attachment 446437 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446437&action=review > Source/WebCore/WebCore.xcodeproj/project.pbxproj:1015 > + 32112E0F274B47CF007047A8 /* SystemFallbackCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 32899FB9274B410C00855A9D /* SystemFallbackCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; Can this file have the word "font" in it somewhere? > Source/WebCore/platform/graphics/SystemFallbackCache.h:81 > + using CharacterFallbackMap = HashMap<CharacterFallbackMapKey, Font*, CharacterFallbackMapKeyHash, CharacterFallbackMapKeyHashTraits>; > + > + HashMap<const Font*, CharacterFallbackMap> m_characterFallbackMaps; Why is this a HashMap of HashMaps? I guess this patch is just moving code around, but we should probably at least have a bug filed about investigating whether we can use less memory and probably have better performance for this.
Cameron McCormack (:heycam)
Comment 6 2021-12-09 20:46:24 PST
(In reply to Myles C. Maxfield from comment #5) > > Source/WebCore/platform/graphics/SystemFallbackCache.h:81 > > + using CharacterFallbackMap = HashMap<CharacterFallbackMapKey, Font*, CharacterFallbackMapKeyHash, CharacterFallbackMapKeyHashTraits>; > > + > > + HashMap<const Font*, CharacterFallbackMap> m_characterFallbackMaps; > > Why is this a HashMap of HashMaps? > > I guess this patch is just moving code around, but we should probably at > least have a bug filed about investigating whether we can use less memory > and probably have better performance for this. Filed https://bugs.webkit.org/show_bug.cgi?id=234121.
Radar WebKit Bug Importer
Comment 7 2021-12-14 22:00:34 PST
Matt Woodrow
Comment 8 2022-05-18 18:51:10 PDT
Created attachment 459563 [details] Rebased patch
Matt Woodrow
Comment 9 2022-05-18 20:30:01 PDT
Matt Woodrow
Comment 10 2022-07-18 23:33:06 PDT
Matt Woodrow
Comment 11 2022-07-18 23:35:33 PDT
EWS
Comment 12 2022-07-19 13:26:03 PDT
'Myles Maxfield' is not a reviewer, blocking PR #None
Matt Woodrow
Comment 13 2022-07-19 13:35:17 PDT
EWS
Comment 14 2022-07-19 15:18:12 PDT
Committed 252618@main (38edf7c001dd): <https://commits.webkit.org/252618@main> Reviewed commits have been landed. Closing PR #2562 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.