Bug 223995 - Make FontCache self-contained (remove static global variables)
Summary: Make FontCache self-contained (remove static global variables)
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Lord
Keywords: InRadar
Depends on:
Blocks: 202793 223997
  Show dependency treegraph
Reported: 2021-03-31 05:43 PDT by Chris Lord
Modified: 2021-03-31 15:04 PDT (History)
4 users (show)

See Also:

Patch (20.63 KB, patch)
2021-03-31 05:48 PDT, Chris Lord
no flags Details | Formatted Diff | Diff
Patch (14.56 KB, patch)
2021-03-31 14:18 PDT, Chris Lord
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 Darin Adler 2021-03-31 10:11:49 PDT
Comment on attachment 424762 [details]

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]
Comment 4 Chris Lord 2021-03-31 14:20:21 PDT
Comment on attachment 424820 [details]

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