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

Unified Diff: Source/bindings/v8/V8GarbageCollected.h

Issue 337053004: Don't assert when ServiceWorker::from is passed an empty promise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix V8GarbageCollected ASSERT Created 6 years, 6 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: 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

Powered by Google App Engine
This is Rietveld 408576698