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

Unified Diff: Source/bindings/core/v8/ScriptPromiseResolver.h

Issue 1148383012: Oilpan: prefer eager finalization over prefinalizers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: expand&improve comments Created 5 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPromiseResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
{
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPromiseResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698