Open Bug 1756464 Opened 3 years ago Updated 2 years ago

[meta] Make text rendering code thread-safe, to allow use of Canvas2d text APIs in workers

Categories

(Core :: Layout: Text and Fonts, task, P2)

task

Tracking

()

People

(Reporter: jfkthame, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: meta)

To allow OffscreenCanvas to use the full Canvas2d API, including text-rendering methods, we need to allow multithreaded use of the font-loading and text-shaping code.

Unless we make a lot of font-related objects thread-local (which is probably not desirable from a memory footprint point of view, and would lose some of the performance benefits of caching font instances and shaping results), we'll need appropriate locking in a number of places, I think.

Most of the font-related objects are read much more often than written, so when rendering threads are only reading font data they needn't block each other. We can use RWLock locks so that multiple threads can have simultaneous read access, and only block in the less-common case where something actually needs to be updated.

I propose to file dependent bugs here for the various specific classes that need added locking.

Severity: -- → S3
Type: defect → task
Priority: -- → P2
Depends on: 1756466
Depends on: 1756468
Depends on: 1756474
Depends on: 1758721
Depends on: 1758946
Depends on: 1759686
Depends on: 1759688
Depends on: 1763414
Blocks: 1765545
No longer depends on: 1758946
No longer depends on: 1759686
Depends on: 1768554
Depends on: 1768759
Depends on: 1774192
Depends on: 1777475
You need to log in before you can comment on or make changes to this bug.