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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PromiseRejectionEvent_h 5 #ifndef PromiseRejectionEvent_h
6 #define PromiseRejectionEvent_h 6 #define PromiseRejectionEvent_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h"
8 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
10 #include "core/CoreExport.h" 11 #include "core/CoreExport.h"
11 #include "core/events/Event.h" 12 #include "core/events/Event.h"
12 #include "core/events/PromiseRejectionEventInit.h" 13 #include "core/events/PromiseRejectionEventInit.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class CORE_EXPORT PromiseRejectionEvent : public Event { 17 class CORE_EXPORT PromiseRejectionEvent final : public Event {
17 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
18 public: 19 public:
19 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create() 20 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create()
20 { 21 {
21 return adoptRefWillBeNoop(new PromiseRejectionEvent); 22 return adoptRefWillBeNoop(new PromiseRejectionEvent);
22 } 23 }
23 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(const AtomicStri ng& type, const PromiseRejectionEventInit& initializer) 24 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(const AtomicStri ng& type, const PromiseRejectionEventInit& initializer)
24 { 25 {
25 return adoptRefWillBeNoop(new PromiseRejectionEvent(type, initializer)); 26 return adoptRefWillBeNoop(new PromiseRejectionEvent(type, initializer));
26 } 27 }
27 28
28 ScriptValue reason() const { return m_reason; } 29 ScriptValue reason(ScriptState*) const;
29 ScriptPromise promise() const { return m_promise; } 30 ScriptPromise promise(ScriptState*) const;
30 31
31 virtual const AtomicString& interfaceName() const override; 32 virtual const AtomicString& interfaceName() const override;
32 33
33 DECLARE_VIRTUAL_TRACE(); 34 DECLARE_VIRTUAL_TRACE();
34 35
35 private: 36 private:
36 PromiseRejectionEvent(); 37 PromiseRejectionEvent();
37 PromiseRejectionEvent(const AtomicString& type, ScriptPromise, ScriptValue r eason); 38 PromiseRejectionEvent(const AtomicString& type, ScriptPromise, ScriptValue r eason);
38 PromiseRejectionEvent(const AtomicString&, const PromiseRejectionEventInit&) ; 39 PromiseRejectionEvent(const AtomicString&, const PromiseRejectionEventInit&) ;
39 ~PromiseRejectionEvent() override; 40 ~PromiseRejectionEvent() override;
40 41
41 ScriptPromise m_promise; 42 static void didCollectPromise(const v8::WeakCallbackInfo<PromiseRejectionEve nt>&);
42 ScriptValue m_reason; 43 static void didCollectReason(const v8::WeakCallbackInfo<PromiseRejectionEven t>&);
44
45 ScopedPersistent<v8::Value> m_promise;
46 ScopedPersistent<v8::Value> m_reason;
43 }; 47 };
44 48
45 } // namespace blink 49 } // namespace blink
46 50
47 #endif // PromiseRejectionEvent_h 51 #endif // PromiseRejectionEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698