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

Unified Diff: Source/core/events/PromiseRejectionEvent.h

Issue 1189513004: Fix memory leaks caused by PromiseRejectionEvents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/core/events/PromiseRejectionEvent.h
diff --git a/Source/core/events/PromiseRejectionEvent.h b/Source/core/events/PromiseRejectionEvent.h
index 394698fef9e3dae9966bbec4f0d6f91194daaeec..40d347f445fc666d27c88102a09e1c3c918a55ab 100644
--- a/Source/core/events/PromiseRejectionEvent.h
+++ b/Source/core/events/PromiseRejectionEvent.h
@@ -5,6 +5,7 @@
#ifndef PromiseRejectionEvent_h
#define PromiseRejectionEvent_h
+#include "bindings/core/v8/ScopedPersistent.h"
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptValue.h"
#include "core/CoreExport.h"
@@ -13,7 +14,7 @@
namespace blink {
-class CORE_EXPORT PromiseRejectionEvent : public Event {
+class CORE_EXPORT PromiseRejectionEvent final : public Event {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create()
@@ -25,8 +26,8 @@ public:
return adoptRefWillBeNoop(new PromiseRejectionEvent(type, initializer));
}
- ScriptValue reason() const { return m_reason; }
- ScriptPromise promise() const { return m_promise; }
+ ScriptValue reason(ScriptState*) const;
+ ScriptPromise promise(ScriptState*) const;
virtual const AtomicString& interfaceName() const override;
@@ -38,8 +39,11 @@ private:
PromiseRejectionEvent(const AtomicString&, const PromiseRejectionEventInit&);
~PromiseRejectionEvent() override;
- ScriptPromise m_promise;
- ScriptValue m_reason;
+ static void didCollectPromise(const v8::WeakCallbackInfo<PromiseRejectionEvent>&);
+ static void didCollectReason(const v8::WeakCallbackInfo<PromiseRejectionEvent>&);
+
+ ScopedPersistent<v8::Value> m_promise;
+ ScopedPersistent<v8::Value> m_reason;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698