ThreadAssertions has so far been used exclusively within WebCore. Since WebCore rarely needs to distinguish between the UI thread and the Web thread, make ThreadAssertions treat them the same so that it can be used in situations where objects are interacted with in both.
Created attachment 446277 [details] Patch
(In reply to Cameron McCormack (:heycam) from comment #0) > ThreadAssertions has so far been used exclusively within WebCore. That is completely false; it's been used exclusively within WebKit. Perhaps ThreadAssertions needs an option to choose whether to use isMainThread() for main thread checking.
I thought I'd templatize ThreadAssertion with a parameter that indicates whether to use isMainThread() to check for main-threadedness, but that seemed to confuse clang into thinking the relevant capability was not acquired. Forthcoming patch just duplicates the ThreadAssertion class with this different behavior. Comments on a better name welcome.
Created attachment 446283 [details] Patch
Comment on attachment 446283 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446283&action=review > Source/WTF/wtf/ThreadAssertions.h:130 > would mainThread named assertion work for you instead? example in ThreadAssertionsTest.cpp
Comment on attachment 446283 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446283&action=review > Source/WTF/wtf/ThreadAssertions.h:76 > +class WTF_CAPABILITY_LOCK MainOrOtherThreadAssertion { Could you name it as "SequenceAssertion". E.g. a "sequence" is a ..sequence.. where actions happen serially. (As implemented by a work queue, or gcd queue)
<rdar://problem/86501473>