Hi Jonathan,

For Stylo to compute values for 'ex' and 'ch' units, it needs access to
font metrics from the parallel worker threads. I've heard that font metrics
are generally not thread-safe in Gecko, so I'm trying to figure out next
steps, and have a few questions:

(1) How not-thread-safe is the font metric stuff? If we just need trivial
stuff like the things mentioned above, will we still run into problems?

(2) Assuming that the information we need does indeed require
non-threadsafe calls, can you tell us whether those calls are strictly
main-thread-only, or whether it's enough to simply avoid concurrency? We
block the main thread during style traversal, so we could stick a mutex
around the font metrics stuff and only acquire that mutex during parallel
traversal (leaving main-thread callpaths untouched). We could then also
cache the metrics we need in TLS to further-reduce the synchronization cost.

Thanks,
bholley
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to