Enable font preferences to be accessed by worker threads
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox100 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
To support text rendering in offscreen canvas2d, we'll need to access the font prefs (font.name-list.serif.<lang>
etc) in order to resolve CSS generics and handle fallback. These are an open-ended set of string prefs, so we can't simply move them to StaticPrefs.
My current thought is to preload the font prefs, probably during gfxPlatformFontList initialization, and store them in-memory in a hash table or similar; worker threads will be allowed read-only access.
Any pref changes can be handled on the main thread only, and then the cached in-memory copy atomically replaced by a new version.
Assignee | ||
Comment 1•3 years ago
|
||
This doesn't in itself make them thread-safe, but it provides a basis to do so by avoiding
dependence on the Preferences service at textrun-construction time.
The FontPrefs record is inert once constructed, so one approach to worker-thread use would
be to make it refcounted, and have the worker hold a strong reference to the record it's using,
so that it won't be affected if the main thread handles a pref-change and replaces its
FontPrefs. Alternatively, maybe we can just protect access with the same lock as other uses
of the font list, once that is in place (bug 1756474).
Updated•3 years ago
|
Comment 3•3 years ago
|
||
bugherder |
Comment 4•3 years ago
|
||
== Change summary for alert #33533 (as of Tue, 15 Mar 2022 18:28:25 GMT) ==
Regressions:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
2% | Base Content Heap Unclassified | linux1804-64-shippable-qr | 1,986,578.00 -> 2,029,086.67 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=33533
Description
•