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; } |