| 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 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 #include "core/events/PromiseRejectionEvent.h" | 7 #include "core/events/PromiseRejectionEvent.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 if (initializer.hasReason()) { | 22 if (initializer.hasReason()) { |
| 23 m_reason.set(initializer.reason().isolate(), initializer.reason().v8Valu
e()); | 23 m_reason.set(initializer.reason().isolate(), initializer.reason().v8Valu
e()); |
| 24 m_reason.setWeak(this, &PromiseRejectionEvent::didCollectReason); | 24 m_reason.setWeak(this, &PromiseRejectionEvent::didCollectReason); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 PromiseRejectionEvent::~PromiseRejectionEvent() | 28 PromiseRejectionEvent::~PromiseRejectionEvent() |
| 29 { | 29 { |
| 30 } | 30 } |
| 31 | 31 |
| 32 ScriptPromise PromiseRejectionEvent::promise(ScriptState* state) const | 32 v8::Local<v8::Value> PromiseRejectionEvent::promise(v8::Isolate* isolate) const |
| 33 { | 33 { |
| 34 v8::Local<v8::Value> value = m_promise.newLocal(state->isolate()); | 34 return m_promise.newLocal(isolate); |
| 35 return ScriptPromise(state, value); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const | 37 v8::Local<v8::Value> PromiseRejectionEvent::reason(v8::Isolate* isolate) const |
| 39 { | 38 { |
| 40 v8::Local<v8::Value> value = m_reason.newLocal(state->isolate()); | 39 return m_reason.newLocal(isolate); |
| 41 return ScriptValue(state, value); | |
| 42 } | 40 } |
| 43 | 41 |
| 44 const AtomicString& PromiseRejectionEvent::interfaceName() const | 42 const AtomicString& PromiseRejectionEvent::interfaceName() const |
| 45 { | 43 { |
| 46 return EventNames::PromiseRejectionEvent; | 44 return EventNames::PromiseRejectionEvent; |
| 47 } | 45 } |
| 48 | 46 |
| 49 DEFINE_TRACE(PromiseRejectionEvent) | 47 DEFINE_TRACE(PromiseRejectionEvent) |
| 50 { | 48 { |
| 51 Event::trace(visitor); | 49 Event::trace(visitor); |
| 52 } | 50 } |
| 53 | 51 |
| 54 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise
RejectionEvent>& data) | 52 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise
RejectionEvent>& data) |
| 55 { | 53 { |
| 56 data.GetParameter()->m_promise.clear(); | 54 data.GetParameter()->m_promise.clear(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR
ejectionEvent>& data) | 57 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR
ejectionEvent>& data) |
| 60 { | 58 { |
| 61 data.GetParameter()->m_reason.clear(); | 59 data.GetParameter()->m_reason.clear(); |
| 62 } | 60 } |
| 63 | 61 |
| 64 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |