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

Unified Diff: third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp

Issue 2196543003: Add a pre-finalizer to PromiseRejectionEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 5 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 | « third_party/WebKit/Source/core/events/PromiseRejectionEvent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp b/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp
index ec621fc9becbad9dd145606d5057124abdccc440..06d029598a2779cb06b87609d5fd300f8e45004a 100644
--- a/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp
+++ b/third_party/WebKit/Source/core/events/PromiseRejectionEvent.cpp
@@ -17,6 +17,7 @@ PromiseRejectionEvent::PromiseRejectionEvent(ScriptState* state, const AtomicStr
: Event(type, initializer)
, m_scriptState(state)
{
+ ThreadState::current()->registerPreFinalizer(this);
ASSERT(initializer.hasPromise());
m_promise.set(initializer.promise().isolate(), initializer.promise().v8Value());
m_promise.setPhantom();
@@ -30,6 +31,15 @@ PromiseRejectionEvent::~PromiseRejectionEvent()
{
}
+void PromiseRejectionEvent::dispose()
+{
+ // Clear ScopedPersistents so that V8 doesn't call phantom callbacks
+ // (and touch the ScopedPersistents) after Oilpan starts lazy sweeping.
+ m_promise.clear();
+ m_reason.clear();
+ m_scriptState.clear();
+}
+
ScriptPromise PromiseRejectionEvent::promise(ScriptState* state) const
{
// Return null when the promise is accessed by a different world than the world that created the promise.
« no previous file with comments | « third_party/WebKit/Source/core/events/PromiseRejectionEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698