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