| 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/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 9 #include "bindings/core/v8/ScopedPersistent.h" | 9 #include "bindings/core/v8/ScopedPersistent.h" |
| 10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| 11 #include "bindings/core/v8/ScriptState.h" | 11 #include "bindings/core/v8/ScriptState.h" |
| 12 #include "bindings/core/v8/ScriptValue.h" | 12 #include "bindings/core/v8/ScriptValue.h" |
| 13 #include "core/CoreExport.h" | 13 #include "core/CoreExport.h" |
| 14 #include "core/events/Event.h" | 14 #include "core/events/Event.h" |
| 15 #include "core/events/PromiseRejectionEventInit.h" | 15 #include "core/events/PromiseRejectionEventInit.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class CORE_EXPORT PromiseRejectionEvent final : public Event { | 19 class CORE_EXPORT PromiseRejectionEvent final : public Event { |
| 20 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
| 21 USING_PRE_FINALIZER(PromiseRejectionEvent, dispose); | 21 USING_PRE_FINALIZER(PromiseRejectionEvent, dispose); |
| 22 public: | 22 public: |
| 23 static PromiseRejectionEvent* create() | |
| 24 { | |
| 25 return new PromiseRejectionEvent; | |
| 26 } | |
| 27 static PromiseRejectionEvent* create(ScriptState* state, const AtomicString&
type, const PromiseRejectionEventInit& initializer) | 23 static PromiseRejectionEvent* create(ScriptState* state, const AtomicString&
type, const PromiseRejectionEventInit& initializer) |
| 28 { | 24 { |
| 29 return new PromiseRejectionEvent(state, type, initializer); | 25 return new PromiseRejectionEvent(state, type, initializer); |
| 30 } | 26 } |
| 31 | 27 |
| 32 ScriptValue reason(ScriptState*) const; | 28 ScriptValue reason(ScriptState*) const; |
| 33 ScriptPromise promise(ScriptState*) const; | 29 ScriptPromise promise(ScriptState*) const; |
| 34 | 30 |
| 35 void setWrapperReference(v8::Isolate*, const v8::Persistent<v8::Object>&); | 31 void setWrapperReference(v8::Isolate*, const v8::Persistent<v8::Object>&); |
| 36 | 32 |
| 37 const AtomicString& interfaceName() const override; | 33 const AtomicString& interfaceName() const override; |
| 38 | 34 |
| 39 // PromiseRejectionEvents are similar to ErrorEvents in that they can't be | 35 // PromiseRejectionEvents are similar to ErrorEvents in that they can't be |
| 40 // observed across different worlds. | 36 // observed across different worlds. |
| 41 bool canBeDispatchedInWorld(const DOMWrapperWorld&) const override; | 37 bool canBeDispatchedInWorld(const DOMWrapperWorld&) const override; |
| 42 | 38 |
| 43 DECLARE_VIRTUAL_TRACE(); | 39 DECLARE_VIRTUAL_TRACE(); |
| 44 | 40 |
| 45 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | 41 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
| 46 | 42 |
| 47 private: | 43 private: |
| 48 PromiseRejectionEvent(); | |
| 49 PromiseRejectionEvent(ScriptState*, const AtomicString&, const PromiseReject
ionEventInit&); | 44 PromiseRejectionEvent(ScriptState*, const AtomicString&, const PromiseReject
ionEventInit&); |
| 50 ~PromiseRejectionEvent() override; | 45 ~PromiseRejectionEvent() override; |
| 51 void dispose(); | 46 void dispose(); |
| 52 | 47 |
| 53 RefPtr<ScriptState> m_scriptState; | 48 RefPtr<ScriptState> m_scriptState; |
| 54 ScopedPersistent<v8::Value> m_promise; | 49 ScopedPersistent<v8::Value> m_promise; |
| 55 ScopedPersistent<v8::Value> m_reason; | 50 ScopedPersistent<v8::Value> m_reason; |
| 56 }; | 51 }; |
| 57 | 52 |
| 58 } // namespace blink | 53 } // namespace blink |
| 59 | 54 |
| 60 #endif // PromiseRejectionEvent_h | 55 #endif // PromiseRejectionEvent_h |
| OLD | NEW |