| OLD | NEW |
| 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/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 11 #include "bindings/core/v8/ScriptValue.h" |
| 11 #include "core/CoreExport.h" | 12 #include "core/CoreExport.h" |
| 12 #include "core/events/Event.h" | 13 #include "core/events/Event.h" |
| 13 #include "core/events/PromiseRejectionEventInit.h" | 14 #include "core/events/PromiseRejectionEventInit.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class CORE_EXPORT PromiseRejectionEvent final : public Event { | 18 class CORE_EXPORT PromiseRejectionEvent final : public Event { |
| 18 DEFINE_WRAPPERTYPEINFO(); | 19 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: | 20 public: |
| 20 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create() | 21 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create() |
| 21 { | 22 { |
| 22 return adoptRefWillBeNoop(new PromiseRejectionEvent); | 23 return adoptRefWillBeNoop(new PromiseRejectionEvent); |
| 23 } | 24 } |
| 24 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(const AtomicStri
ng& type, const PromiseRejectionEventInit& initializer) | 25 static PassRefPtrWillBeRawPtr<PromiseRejectionEvent> create(ScriptState* sta
te, const AtomicString& type, const PromiseRejectionEventInit& initializer) |
| 25 { | 26 { |
| 26 return adoptRefWillBeNoop(new PromiseRejectionEvent(type, initializer)); | 27 return adoptRefWillBeNoop(new PromiseRejectionEvent(state, type, initial
izer)); |
| 27 } | 28 } |
| 28 | 29 |
| 29 ScriptValue reason(ScriptState*) const; | 30 ScriptValue reason(ScriptState*) const; |
| 30 ScriptPromise promise(ScriptState*) const; | 31 ScriptPromise promise(ScriptState*) const; |
| 31 | 32 |
| 32 virtual const AtomicString& interfaceName() const override; | 33 virtual const AtomicString& interfaceName() const override; |
| 33 | 34 |
| 34 DECLARE_VIRTUAL_TRACE(); | 35 DECLARE_VIRTUAL_TRACE(); |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 PromiseRejectionEvent(); | 38 PromiseRejectionEvent(); |
| 38 PromiseRejectionEvent(const AtomicString& type, ScriptPromise, ScriptValue r
eason); | 39 PromiseRejectionEvent(ScriptState*, const AtomicString&, const PromiseReject
ionEventInit&); |
| 39 PromiseRejectionEvent(const AtomicString&, const PromiseRejectionEventInit&)
; | |
| 40 ~PromiseRejectionEvent() override; | 40 ~PromiseRejectionEvent() override; |
| 41 | 41 |
| 42 static void didCollectPromise(const v8::WeakCallbackInfo<PromiseRejectionEve
nt>&); | 42 static void didCollectPromise(const v8::WeakCallbackInfo<PromiseRejectionEve
nt>&); |
| 43 static void didCollectReason(const v8::WeakCallbackInfo<PromiseRejectionEven
t>&); | 43 static void didCollectReason(const v8::WeakCallbackInfo<PromiseRejectionEven
t>&); |
| 44 | 44 |
| 45 RefPtr<ScriptState> m_scriptState; |
| 45 ScopedPersistent<v8::Value> m_promise; | 46 ScopedPersistent<v8::Value> m_promise; |
| 46 ScopedPersistent<v8::Value> m_reason; | 47 ScopedPersistent<v8::Value> m_reason; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace blink | 50 } // namespace blink |
| 50 | 51 |
| 51 #endif // PromiseRejectionEvent_h | 52 #endif // PromiseRejectionEvent_h |
| OLD | NEW |