Bug 216370 - CSS parsing-related singletons should only be used on the main thread
Summary: CSS parsing-related singletons should only be used on the main thread
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Lord
URL:
Keywords: InRadar
Depends on:
Blocks: 204575
  Show dependency treegraph
 
Reported: 2020-09-10 09:15 PDT by Chris Lord
Modified: 2020-09-14 01:39 PDT (History)
16 users (show)

See Also:


Attachments
Patch (4.03 KB, patch)
2020-09-10 09:27 PDT, Chris Lord
no flags Details | Formatted Diff | Diff
Patch (3.37 KB, patch)
2020-09-11 01:54 PDT, Chris Lord
no flags Details | Formatted Diff | Diff
Patch (3.36 KB, patch)
2020-09-14 00:57 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 2020-09-10 09:15:14 PDT
Currently, there are various NeverDestroyed singletons involved in CSS parsing that are not intended to ever be used off of the main thread. A sub-set of CSS parsing is required for full OffscreenCanvas support (colour and font strings), so it'd be good for these singletons to be correctly declared as MainThreadNeverDestroyed so that if they are accidentally ever used off of the main thread, we would start to get test failures in debug mode.
Comment 1 Chris Lord 2020-09-10 09:27:02 PDT
Created attachment 408451 [details]
Patch
Comment 2 Chris Lord 2020-09-10 09:29:44 PDT
Note that I changed the RenderTheme singletons for Gtk/Adwaita to MainThread but I haven't touched other platforms as I don't know if they have the same restriction. I expect, perhaps bar iOS, they do, but I'd rather not make the change blind, so if this is accepted, we can open a separate bug/bugs to keep track of other platforms that this doesn't include.

I do wonder if NeverDestroyed should default to asserting the creation thread and the exception should be allowing concurrent access, rather than this way round.
Comment 3 Chris Lord 2020-09-11 01:54:43 PDT
Created attachment 408525 [details]
Patch
Comment 4 Chris Lord 2020-09-14 00:57:07 PDT
Created attachment 408685 [details]
Patch
Comment 5 EWS 2020-09-14 01:38:58 PDT
Committed r267009: <https://trac.webkit.org/changeset/267009>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408685 [details].
Comment 6 Radar WebKit Bug Importer 2020-09-14 01:39:23 PDT
<rdar://problem/68838178>