Bug 233981

Summary: Make Windows font smoothing variables thread safe
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: Layout and RenderingAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, Hironori.Fujii, mattwoodrow, mmaxfield, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 233488    
Attachments:
Description Flags
Patch
none
Patch
mmaxfield: review+
Patch none

Description Cameron McCormack (:heycam) 2021-12-07 22:43:00 PST
Make Windows font smoothing variables thread safe
Comment 1 Cameron McCormack (:heycam) 2021-12-07 22:51:39 PST
Created attachment 446306 [details]
Patch
Comment 2 Cameron McCormack (:heycam) 2021-12-08 15:35:26 PST
Created attachment 446440 [details]
Patch
Comment 3 Cameron McCormack (:heycam) 2021-12-08 15:36:14 PST
Note that I've added WTF_GUARDED_BY_LOCK attributes but this is Windows code, and MSVC doesn't support those, so it's more like documentation.
Comment 4 Myles C. Maxfield 2021-12-08 21:11:17 PST
Comment on attachment 446440 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446440&action=review

> Source/WebCore/ChangeLog:3
> +        Make Windows font smoothing variables thread safe

Is Fujii in the process of deleting these? https://bugs.webkit.org/show_bug.cgi?id=206273
Comment 5 Fujii Hironori 2021-12-09 22:07:55 PST
Comment on attachment 446440 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446440&action=review

>> Source/WebCore/ChangeLog:3
>> +        Make Windows font smoothing variables thread safe
> 
> Is Fujii in the process of deleting these? https://bugs.webkit.org/show_bug.cgi?id=206273

I don't think so. Bug 206273 seems irrelevant.
Comment 6 Myles C. Maxfield 2021-12-10 15:35:52 PST
Comment on attachment 446440 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446440&action=review

I assume you grepped to find all uses?

> Source/WebCore/platform/graphics/FontCascade.h:330
> +    static Lock s_fontSmoothingLock;
> +    static double s_fontSmoothingContrast WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);
> +    static uint32_t s_fontSmoothingType WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);
> +    static int s_fontSmoothingLevel WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);
> +    static uint32_t s_systemFontSmoothingType WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);
> +    static bool s_systemFontSmoothingSet WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);
> +    static bool s_systemFontSmoothingEnabled WTF_GUARDED_BY_LOCK(s_fontSmoothingLock);

I kind of think this is a poor design and these shouldn't be statics in the first place ...
Comment 7 Radar WebKit Bug Importer 2021-12-14 22:43:17 PST
<rdar://problem/86507092>
Comment 8 Matt Woodrow 2022-07-19 15:49:26 PDT
Created attachment 461022 [details]
Patch
Comment 9 EWS 2022-07-19 23:11:17 PDT
Committed 252638@main (85c5eabc2149): <https://commits.webkit.org/252638@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 461022 [details].