Bug 216370

Summary: CSS parsing-related singletons should only be used on the main thread
Product: WebKit Reporter: Chris Lord <clord>
Component: CSSAssignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, changseok, darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, kondapallykalyan, macpherson, menard, mmaxfield, pdr, sam, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 204575    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

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>