WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
27759
[V8] DOMData needs AtomicallyInitializedStatic
https://bugs.webkit.org/show_bug.cgi?id=27759
Summary
[V8] DOMData needs AtomicallyInitializedStatic
Adam Barth
Reported
2009-07-28 01:38:15 PDT
> + > +DOMData* DOMData::getCurrent() > +{ > + if (WTF::isMainThread()) > + return getCurrentMainThread(); > + > + DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<ChildThreadDOMData>, childThreadDOMData, ());
This looks like it has race conditions. Please add a comment about why it isn't or consider switching to using AtomicallyInitializedStatic (from wtf/Threading.h).
Attachments
Add attachment
proposed patch, testcase, etc.
Adam Barth
Comment 1
2009-07-28 01:38:54 PDT
I should say that those words in the issue report are Dave Levin's. I don't understand the issue yet.
David Levin
Comment 2
2009-07-28 01:53:00 PDT
This one too:
> Index: WebCore/bindings/v8/DOMData.h > +WTF::Mutex& DOMDataStore::allStoresMutex() > +{ > + DEFINE_STATIC_LOCAL(WTF::Mutex, staticDOMDataListMutex, ());
This looks like it has race conditions. Please add a comment about why it isn't or consider switching to using AtomicallyInitializedStatic (from wtf/Threading.h).
anton muhin
Comment 3
2009-07-29 09:31:57 PDT
(In reply to
comment #2
)
> This one too: > > > Index: WebCore/bindings/v8/DOMData.h > > +WTF::Mutex& DOMDataStore::allStoresMutex() > > +{ > > + DEFINE_STATIC_LOCAL(WTF::Mutex, staticDOMDataListMutex, ()); > > This looks like it has race conditions. Please add a comment about why it > isn't or consider switching to using AtomicallyInitializedStatic (from > wtf/Threading.h).
Just a minor comment. If I did measurements right, AtomicallyInitializedStatic is rather expensive on Windows, so, please, be careful to measure performance implications. Maybe sometimes it's easier to have plain static at least for main thread. just my 2 cents.
David Levin
Comment 4
2009-07-29 09:40:01 PDT
> If I did measurements right, AtomicallyInitializedStatic is rather expensive on Windows
Likely true. I simply want something that is safe though (for anyone using the bindings in a multithreaded fashion). Of course, there could be a (compile time or runtime) flag that indicates whether this level of safetly is needed.
Adam Barth
Comment 5
2009-07-29 10:37:58 PDT
I bet the main thread static is actually safe. After all, you need to get a Worker wrapper before you can even create another thread. :)
Brian Burg
Comment 6
2014-12-16 00:48:17 PST
Closing some V8-related work items.
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