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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.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/bindings/core/v8/ScriptWrappable.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
index 86f7ae5098299f762aa7592a496f247be059e03b..ac6b70148178b05bc00aec0c84a1077a686e3c84 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h
@@ -61,7 +61,14 @@ class CORE_EXPORT ScriptWrappable : public TraceWrapperBase {
WTF_MAKE_NONCOPYABLE(ScriptWrappable);
public:
- ScriptWrappable() {}
+ ScriptWrappable() {
+#if DCHECK_IS_ON()
+ // 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.
+ DCHECK(ThreadState::current()->canAllocateScriptWrappable());
+#endif
+ }
bool isScriptWrappable() const override { return true; }

Powered by Google App Engine
This is Rietveld 408576698