| 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 #include "core/events/PromiseRejectionEvent.h" | 5 #include "core/events/PromiseRejectionEvent.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 PromiseRejectionEvent::PromiseRejectionEvent( | 11 PromiseRejectionEvent::PromiseRejectionEvent( |
| 12 ScriptState* state, | 12 ScriptState* state, |
| 13 const AtomicString& type, | 13 const AtomicString& type, |
| 14 const PromiseRejectionEventInit& initializer) | 14 const PromiseRejectionEventInit& initializer) |
| 15 : Event(type, initializer), m_scriptState(state) { | 15 : Event(type, initializer), |
| 16 m_scriptState(state), |
| 17 m_promise(this), |
| 18 m_reason(this) { |
| 16 ThreadState::current()->registerPreFinalizer(this); | 19 ThreadState::current()->registerPreFinalizer(this); |
| 17 DCHECK(initializer.hasPromise()); | 20 DCHECK(initializer.hasPromise()); |
| 18 m_promise.set(initializer.promise().isolate(), | 21 m_promise.set(initializer.promise().isolate(), |
| 19 initializer.promise().v8Value()); | 22 initializer.promise().v8Value()); |
| 20 m_promise.setPhantom(); | 23 m_promise.setPhantom(); |
| 21 if (initializer.hasReason()) { | 24 if (initializer.hasReason()) { |
| 22 m_reason.set(initializer.reason().isolate(), | 25 m_reason.set(initializer.reason().isolate(), |
| 23 initializer.reason().v8Value()); | 26 initializer.reason().v8Value()); |
| 24 m_reason.setPhantom(); | 27 m_reason.setPhantom(); |
| 25 } | 28 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const DOMWrapperWorld& world) const { | 80 const DOMWrapperWorld& world) const { |
| 78 return m_scriptState && m_scriptState->contextIsValid() && | 81 return m_scriptState && m_scriptState->contextIsValid() && |
| 79 m_scriptState->world().worldId() == world.worldId(); | 82 m_scriptState->world().worldId() == world.worldId(); |
| 80 } | 83 } |
| 81 | 84 |
| 82 DEFINE_TRACE(PromiseRejectionEvent) { | 85 DEFINE_TRACE(PromiseRejectionEvent) { |
| 83 Event::trace(visitor); | 86 Event::trace(visitor); |
| 84 } | 87 } |
| 85 | 88 |
| 86 DEFINE_TRACE_WRAPPERS(PromiseRejectionEvent) { | 89 DEFINE_TRACE_WRAPPERS(PromiseRejectionEvent) { |
| 87 visitor->traceWrappers(&m_promise); | 90 visitor->traceWrappers(m_promise); |
| 88 visitor->traceWrappers(&m_reason); | 91 visitor->traceWrappers(m_reason); |
| 89 } | 92 } |
| 90 | 93 |
| 91 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |