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

Unified Diff: third_party/WebKit/Source/platform/heap/Member.h

Issue 2680843006: Tidy DEFINE_(THREAD_SAFE_)STATIC_LOCAL() implementations. (Closed)
Patch Set: explain safety of HTMLTableSectionElement singletons Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/heap/Member.h
diff --git a/third_party/WebKit/Source/platform/heap/Member.h b/third_party/WebKit/Source/platform/heap/Member.h
index b2bac898b0c9e4b65564bf2e4e3e53dca4d4bd83..5ed599b791d91c9b2af3f63b09d7c6df1942c9f7 100644
--- a/third_party/WebKit/Source/platform/heap/Member.h
+++ b/third_party/WebKit/Source/platform/heap/Member.h
@@ -13,6 +13,7 @@ namespace blink {
template <typename T>
class Persistent;
+class ScriptWrappable;
template <typename T>
class TraceWrapperMember;
@@ -172,6 +173,14 @@ class MemberBase {
// collection iterator.
DCHECK(m_creationThreadState || !m_raw);
}
+
+ // If this DCHECK() triggers, you're attempting to embed a ScriptWrappable
+ // inside a static local singleton, which is unsafe.
+ // See |DEFINE_STATIC_LOCAL()| documentation for further details.
+ if (WTF::IsSubclass<T, blink::ScriptWrappable>::value) {
+ if (m_creationThreadState)
+ DCHECK(m_creationThreadState->canAllocateScriptWrappable());
haraken 2017/02/11 10:25:20 Would you help me understand why we need to have t
sof 2017/02/11 12:09:11 Good question to raise -- the "no ScriptWrappable"
+ }
#endif
}

Powered by Google App Engine
This is Rietveld 408576698