Index: Source/bindings/core/v8/ScriptPromiseResolver.h |
diff --git a/Source/bindings/core/v8/ScriptPromiseResolver.h b/Source/bindings/core/v8/ScriptPromiseResolver.h |
index 6af0ff44cb364f90c211cc6300a0e535a87015a9..a2c1eb9e3785b96e78fb21db1672bac0251b7450 100644 |
--- a/Source/bindings/core/v8/ScriptPromiseResolver.h |
+++ b/Source/bindings/core/v8/ScriptPromiseResolver.h |
@@ -28,9 +28,6 @@ namespace blink { |
// will be ignored. |
class CORE_EXPORT ScriptPromiseResolver : public RefCountedWillBeRefCountedGarbageCollected<ScriptPromiseResolver>, public ActiveDOMObject { |
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScriptPromiseResolver); |
-#if ENABLE(ASSERT) |
- WILL_BE_USING_PRE_FINALIZER(ScriptPromiseResolver, assertNotPending); |
-#endif |
WTF_MAKE_NONCOPYABLE(ScriptPromiseResolver); |
public: |
static PassRefPtrWillBeRawPtr<ScriptPromiseResolver> create(ScriptState* scriptState) |
@@ -40,10 +37,18 @@ public: |
return resolver.release(); |
} |
-#if !ENABLE(OILPAN) && ENABLE(ASSERT) |
+#if ENABLE(ASSERT) |
+ // Eagerly finalized so as to ensure valid access to executionContext() |
+ // from the destructor's assert. |
+ EAGERLY_FINALIZE(); |
+ |
~ScriptPromiseResolver() override |
{ |
- assertNotPending(); |
+ // This assertion fails if: |
+ // - promise() is called at least once and |
+ // - this resolver is destructed before it is resolved, rejected or |
+ // the associated ExecutionContext is stopped. |
+ ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled || !executionContext() || executionContext()->activeDOMObjectsAreStopped()); |
} |
#endif |
@@ -107,19 +112,6 @@ private: |
KeepAliveWhilePending, |
}; |
-#if ENABLE(ASSERT) |
- void assertNotPending() |
- { |
- // This assertion fails if: |
- // - promise() is called at least once and |
- // - this resolver is destructed before it is resolved, rejected or |
- // the associated ExecutionContext is stopped. |
- // This function cannot be run in the destructor if |
- // ScriptPromiseResolver is on-heap. |
- ASSERT(m_state == ResolvedOrRejected || !m_isPromiseCalled || !executionContext() || executionContext()->activeDOMObjectsAreStopped()); |
- } |
-#endif |
- |
template<typename T> |
void resolveOrReject(T value, ResolutionState newState) |
{ |