Bug 223995

Summary: Make FontCache self-contained (remove static global variables)
Product: WebKit Reporter: Chris Lord <clord>
Component: WebCore Misc.Assignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ews-watchlist, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 202793, 223997    
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Lord 2021-03-31 05:43:12 PDT
Currently the FontCache singleton contains some of the structures it relies on, but also has some static global variables for reasons that are unclear to me. For example, the actual font cache lives on FontCache, but the list of FontCacheClients is a global variable.

The current plan is for OffscreenCanvas to use a separate FontCache so as not to affect the performance of the main FontCache. To do this, FontCache needs to be fully self-contained.
Comment 1 Chris Lord 2021-03-31 05:48:43 PDT
Created attachment 424762 [details]
Patch
Comment 2 Darin Adler 2021-03-31 10:11:49 PDT
Comment on attachment 424762 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424762&action=review

> Source/WebCore/platform/graphics/FontCache.h:299
> +    struct FontPlatformDataCacheKey {

If we want to keep this all out of the header, we can put these things into a structure in a WTF::UniqueRef instead of directly into the FontCache object itself. Uses a little more memory, but helps keep the FontCache.h file smaller.
Comment 3 Chris Lord 2021-03-31 14:18:23 PDT
Created attachment 424820 [details]
Patch
Comment 4 Chris Lord 2021-03-31 14:20:21 PDT
Comment on attachment 424820 [details]
Patch

Comment addressed.
Comment 5 EWS 2021-03-31 15:03:12 PDT
Committed r275308: <https://commits.webkit.org/r275308>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424820 [details].
Comment 6 Radar WebKit Bug Importer 2021-03-31 15:04:13 PDT
<rdar://problem/76072958>