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 f64cdb08738cda741ad2e7ed522262a3a6f0f152..4be6a52788f3dc08dbd27ecd00e4662dd70f38b2 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappable.h |
@@ -46,6 +46,7 @@ class CORE_EXPORT TraceWrapperBase { |
public: |
TraceWrapperBase() = default; |
+ virtual bool isScriptWrappable() const { return false; } |
DECLARE_VIRTUAL_TRACE_WRAPPERS(){}; |
}; |
@@ -62,6 +63,8 @@ class CORE_EXPORT ScriptWrappable : public TraceWrapperBase { |
public: |
ScriptWrappable() {} |
+ bool isScriptWrappable() const override { return true; } |
+ |
template <typename T> |
T* toImpl() { |
// All ScriptWrappables are managed by the Blink GC heap; check that |
@@ -166,6 +169,7 @@ class CORE_EXPORT ScriptWrappable : public TraceWrapperBase { |
private: |
// These classes are exceptionally allowed to use mainWorldWrapper(). |
friend class DOMDataStore; |
+ friend class HeapSnaphotWrapperVisitor; |
friend class V8HiddenValue; |
friend class V8PrivateProperty; |
friend class WebGLRenderingContextBase; |
@@ -174,6 +178,13 @@ class CORE_EXPORT ScriptWrappable : public TraceWrapperBase { |
return v8::Local<v8::Object>::New(isolate, m_mainWorldWrapper); |
} |
+ // Only use when really necessary, i.e., when passing over this |
+ // ScriptWrappable's reference to V8. Should only be needed by GC |
+ // infrastructure. |
+ const v8::Persistent<v8::Object>* rawMainWorldWrapper() const { |
+ return &m_mainWorldWrapper; |
+ } |
+ |
v8::Persistent<v8::Object> m_mainWorldWrapper; |
}; |