They ensure that access and construction are done in the main thread.
Created attachment 398139 [details] Patch
Created attachment 398141 [details] Patch
Comment on attachment 398141 [details] Patch r=me.
Comment on attachment 398141 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398141&action=review > Source/WebCore/html/InputTypeNames.cpp:37 > return name; It seems enough to just add ASSERT(isMainThread()). What't the difference? The return type of this function is just AtomString, not MainThreadNeverDestroyed<const AtomString>.
Comment on attachment 398141 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398141&action=review >> Source/WebCore/html/InputTypeNames.cpp:37 >> return name; > > It seems enough to just add ASSERT(isMainThread()). > What't the difference? > The return type of this function is just AtomString, not MainThreadNeverDestroyed<const AtomString>. MainThreadNeverDestroyed declaratively says that this should be accessed from the main thread. And `ASSERT(isMainThread())` is automatically inserted by MainThreadNeverDestroyed, instead of manually inserting it to every places. So I think this prevents us from using AtomString from the main thread accidentally, and this tells good thread-affinity information to readers of the code explicitly :)
Created attachment 398146 [details] Patch Patch for landing, resolved Saam's comment
Created attachment 398148 [details] Patch Patch for landing, resolved Saam's comment
Created attachment 398152 [details] Patch Patch for landing, resolved Saam's comment
Created attachment 398155 [details] Patch Patch for landing, fixing iOS build
Comment on attachment 398155 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398155&action=review > Source/WTF/wtf/text/AtomString.cpp:137 > +WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> nullAtomData; > +WTF_EXPORT_PRIVATE MainThreadLazyNeverDestroyed<const AtomString> emptyAtomData; Crash looks like due to nullAtom and emptyAtom. But they are specially OK Atoms since those definitions are the same and can be shared between multiple threads (since they are not actually registered in AtomStringTable). I'll slightly modify to handle them specially (just using LazyNeverDestroyed<>) to see the results.
Created attachment 398168 [details] Patch Patch for landing, fixing Windows builds and Debug crash due to nullAtom & emptyAtom
Created attachment 398192 [details] Patch Patch for landing, fixing Windows builds and Debug crash due to nullAtom & emptyAtom
Committed r261013: <https://trac.webkit.org/changeset/261013>
<rdar://problem/62742993>