Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Issue 874203002: Add a thread-safety assertion in DEFINE_STATIC_LOCAL (Closed)

Created:
5 years, 11 months ago by kinuko
Modified:
5 years, 10 months ago
CC:
aandrey+blink_chromium.org, blink-reviews, blink-reviews-wtf_chromium.org, dominicc (has gone to gerrit), Mikhail
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Add a thread-safety assertion in DEFINE_STATIC_LOCAL Asserts if DEFINE_STATIC_LOCAL's usage is safe: - Its first call is made before we create other threads, or - It's called only on a single thread, or - It's called inside a AtomicallyInitializedStatic BUG=367982 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=189547

Patch Set 1 : #

Total comments: 1

Patch Set 2 : rebased #

Total comments: 4

Patch Set 3 : addressed eric's comments #

Total comments: 2

Patch Set 4 : added noncopyable #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -25 lines) Patch
M Source/core/css/parser/CSSTokenizerTest.cpp View 1 chunk +21 lines, -21 lines 0 comments Download
M Source/modules/webdatabase/Database.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M Source/platform/WebThreadSupportingGC.cpp View 1 chunk +5 lines, -0 lines 2 comments Download
M Source/wtf/MainThread.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M Source/wtf/StdLibExtras.h View 1 2 3 1 chunk +42 lines, -0 lines 0 comments Download
M Source/wtf/Threading.h View 1 1 chunk +6 lines, -0 lines 0 comments Download
M Source/wtf/ThreadingPthreads.cpp View 1 2 1 chunk +19 lines, -0 lines 0 comments Download
M Source/wtf/ThreadingWin.cpp View 1 2 1 chunk +19 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (8 generated)
kinuko
I'm thinking about adding an assertion like this (based on eroman@'s strawman), and am fixing ...
5 years, 11 months ago (2015-01-27 14:50:37 UTC) #6
jochen (gone - plz use gerrit)
which tests are failing with this?
5 years, 10 months ago (2015-01-28 19:09:50 UTC) #7
kinuko
On 2015/01/28 19:09:50, jochen (slow) wrote: > which tests are failing with this? I think ...
5 years, 10 months ago (2015-01-29 05:42:20 UTC) #8
jochen (gone - plz use gerrit)
guess that's a good thing then once it passes everywhere you should make sure that ...
5 years, 10 months ago (2015-01-29 15:16:03 UTC) #9
eroman
lgtm https://codereview.chromium.org/874203002/diff/90001/Source/wtf/StdLibExtras.h File Source/wtf/StdLibExtras.h (right): https://codereview.chromium.org/874203002/diff/90001/Source/wtf/StdLibExtras.h#newcode64 Source/wtf/StdLibExtras.h:64: static StaticLocalVerifier name##StaticLocalVerifier; \ How about making this ...
5 years, 10 months ago (2015-01-30 18:02:31 UTC) #10
kinuko
Eric: Thanks, updated. Jochen@: now we're getting ready to land this one (win_blink_rel looks a ...
5 years, 10 months ago (2015-02-03 06:57:34 UTC) #11
jochen (gone - plz use gerrit)
lgtm https://codereview.chromium.org/874203002/diff/110001/Source/wtf/StdLibExtras.h File Source/wtf/StdLibExtras.h (right): https://codereview.chromium.org/874203002/diff/110001/Source/wtf/StdLibExtras.h#newcode37 Source/wtf/StdLibExtras.h:37: public: add WTF_MAKE_NONCOPYABLE?
5 years, 10 months ago (2015-02-04 12:41:05 UTC) #12
kinuko
Thanks, https://codereview.chromium.org/874203002/diff/110001/Source/wtf/StdLibExtras.h File Source/wtf/StdLibExtras.h (right): https://codereview.chromium.org/874203002/diff/110001/Source/wtf/StdLibExtras.h#newcode37 Source/wtf/StdLibExtras.h:37: public: On 2015/02/04 12:41:05, jochen (slow) wrote: > ...
5 years, 10 months ago (2015-02-05 08:58:25 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/874203002/130001
5 years, 10 months ago (2015-02-05 09:00:10 UTC) #16
commit-bot: I haz the power
Committed patchset #4 (id:130001) as https://src.chromium.org/viewvc/blink?view=rev&revision=189547
5 years, 10 months ago (2015-02-05 10:29:58 UTC) #17
kbalazs
https://codereview.chromium.org/874203002/diff/130001/Source/platform/WebThreadSupportingGC.cpp File Source/platform/WebThreadSupportingGC.cpp (right): https://codereview.chromium.org/874203002/diff/130001/Source/platform/WebThreadSupportingGC.cpp#newcode15 Source/platform/WebThreadSupportingGC.cpp:15: WTF::willCreateThread(); How will people not forget to do this ...
5 years, 10 months ago (2015-02-11 05:08:47 UTC) #19
kinuko
5 years, 10 months ago (2015-02-12 02:31:23 UTC) #20
Message was sent while issue was closed.
https://codereview.chromium.org/874203002/diff/130001/Source/platform/WebThre...
File Source/platform/WebThreadSupportingGC.cpp (right):

https://codereview.chromium.org/874203002/diff/130001/Source/platform/WebThre...
Source/platform/WebThreadSupportingGC.cpp:15: WTF::willCreateThread();
On 2015/02/11 05:08:47, kbalazs wrote:
> How will people not forget to do this when they happen to add a new thread?
Can
> it be part of creation of WebThread?

I assumed that in blink we'll be anyway using WebThreadSupportingGC in most
cases, if not all.

> Btw imho it would be nicer to #if guard the body of the function.

Yup, might be. Feel free to create a patch :)

Powered by Google App Engine
This is Rietveld 408576698