Index: Source/bindings/v8/V8GarbageCollected.h |
diff --git a/Source/bindings/v8/V8GarbageCollected.h b/Source/bindings/v8/V8GarbageCollected.h |
index 0645b6ba7193221c847e1a33ec3bdd2a672fd986..697974839d90431c8aea30cc7f4ab5e49e90cb89 100644 |
--- a/Source/bindings/v8/V8GarbageCollected.h |
+++ b/Source/bindings/v8/V8GarbageCollected.h |
@@ -51,12 +51,14 @@ protected: |
V8GarbageCollected(v8::Isolate* isolate) |
: m_isolate(isolate) |
, m_handle(isolate, v8::External::New(isolate, static_cast<T*>(this))) |
+ , m_releasedToV8GarbageCollector(false) |
{ |
} |
v8::Handle<v8::External> releaseToV8GarbageCollector() |
{ |
ASSERT(!m_handle.isWeak()); // Call this exactly once. |
+ m_releasedToV8GarbageCollector = true; |
v8::Handle<v8::External> result = m_handle.newLocal(m_isolate); |
m_handle.setWeak(static_cast<T*>(this), &weakCallback); |
return result; |
@@ -64,7 +66,7 @@ protected: |
~V8GarbageCollected() |
{ |
- ASSERT(m_handle.isEmpty()); |
+ ASSERT(!m_releasedToV8GarbageCollector || m_handle.isEmpty()); |
haraken
2014/06/17 02:46:24
Can we use m_handle.IsWeak() instead of introducin
falken
2014/06/17 03:43:04
No, m_handle.IsWeak() is false until releaseToV8Ga
|
} |
v8::Isolate* isolate() { return m_isolate; } |
@@ -79,6 +81,7 @@ private: |
v8::Isolate* m_isolate; |
ScopedPersistent<v8::External> m_handle; |
+ bool m_releasedToV8GarbageCollector; |
}; |
} // namespace WebCore |