Bug 226446

Summary: Stop using WTF_IGNORES_THREAD_SAFETY_ANALYSIS in MediaRecorderPrivateWriter code
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: MediaAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, peng.liu6, philipj, sam, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Chris Dumez 2021-05-30 19:32:05 PDT
Stop using WTF_IGNORES_THREAD_SAFETY_ANALYSIS in MediaRecorderPrivateWriter code by refactoring the code slightly.
Comment 1 Chris Dumez 2021-05-30 19:33:25 PDT
Created attachment 430165 [details]
Patch
Comment 2 Darin Adler 2021-05-31 16:51:30 PDT
Comment on attachment 430165 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        this thread safety checks do not apply to destructors.

"this" -> "since"

Seems like this doesn’t really make anything safer! Just quiets the compiler.
Comment 3 Chris Dumez 2021-05-31 17:01:32 PDT
Comment on attachment 430165 [details]
Patch

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

>> Source/WebCore/ChangeLog:10
>> +        this thread safety checks do not apply to destructors.
> 
> "this" -> "since"
> 
> Seems like this doesn’t really make anything safer! Just quiets the compiler.

I think it makes the code look safer. There is a reason clang doesn't apply threading checks to constructors and destructors: there is usually a single thread when those are executed.
I much prefer this than having a separate clear() function annotated with WTF_IGNORES_THREAD_SAFETY_ANALYSIS, which might get called from outside the destructor in the future, in an unsafe way.
Comment 4 Chris Dumez 2021-05-31 17:05:01 PDT
Committed r278286 (238323@main): <https://commits.webkit.org/238323@main>
Comment 5 Radar WebKit Bug Importer 2021-05-31 17:05:20 PDT
<rdar://problem/78695299>