WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 211264
Introduce MainThreadNeverDestroyed / MainThreadLazyNeverDestroyed
https://bugs.webkit.org/show_bug.cgi?id=211264
Summary
Introduce MainThreadNeverDestroyed / MainThreadLazyNeverDestroyed
Yusuke Suzuki
Reported
2020-04-30 16:18:38 PDT
They ensure that access and construction are done in the main thread.
Attachments
Patch
(162.49 KB, patch)
2020-04-30 19:06 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(162.50 KB, patch)
2020-04-30 19:10 PDT
,
Yusuke Suzuki
mark.lam
: review+
Details
Formatted Diff
Diff
Patch
(141.49 KB, patch)
2020-04-30 19:47 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(141.71 KB, patch)
2020-04-30 20:02 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(141.93 KB, patch)
2020-04-30 20:26 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(142.03 KB, patch)
2020-04-30 20:48 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(142.12 KB, patch)
2020-05-01 01:42 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(142.13 KB, patch)
2020-05-01 09:50 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2020-04-30 19:06:25 PDT
Created
attachment 398139
[details]
Patch
Yusuke Suzuki
Comment 2
2020-04-30 19:10:44 PDT
Created
attachment 398141
[details]
Patch
Mark Lam
Comment 3
2020-04-30 19:24:50 PDT
Comment on
attachment 398141
[details]
Patch r=me.
Fujii Hironori
Comment 4
2020-04-30 19:35:00 PDT
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>.
Yusuke Suzuki
Comment 5
2020-04-30 19:42:53 PDT
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 :)
Yusuke Suzuki
Comment 6
2020-04-30 19:47:02 PDT
Created
attachment 398146
[details]
Patch Patch for landing, resolved Saam's comment
Yusuke Suzuki
Comment 7
2020-04-30 20:02:52 PDT
Created
attachment 398148
[details]
Patch Patch for landing, resolved Saam's comment
Yusuke Suzuki
Comment 8
2020-04-30 20:26:31 PDT
Created
attachment 398152
[details]
Patch Patch for landing, resolved Saam's comment
Yusuke Suzuki
Comment 9
2020-04-30 20:48:37 PDT
Created
attachment 398155
[details]
Patch Patch for landing, fixing iOS build
Yusuke Suzuki
Comment 10
2020-05-01 01:34:54 PDT
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.
Yusuke Suzuki
Comment 11
2020-05-01 01:42:15 PDT
Created
attachment 398168
[details]
Patch Patch for landing, fixing Windows builds and Debug crash due to nullAtom & emptyAtom
Yusuke Suzuki
Comment 12
2020-05-01 09:50:27 PDT
Created
attachment 398192
[details]
Patch Patch for landing, fixing Windows builds and Debug crash due to nullAtom & emptyAtom
Yusuke Suzuki
Comment 13
2020-05-01 12:47:47 PDT
Committed
r261013
: <
https://trac.webkit.org/changeset/261013
>
Radar WebKit Bug Importer
Comment 14
2020-05-01 12:48:17 PDT
<
rdar://problem/62742993
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug