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), | 15 : Event(type, initializer), |
16 m_world(state->world()), | 16 m_world(state->world()), |
17 m_promise(this), | 17 m_promise(this), |
18 m_reason(this) { | 18 m_reason(this) { |
19 ThreadState::current()->registerPreFinalizer(this); | |
20 DCHECK(initializer.hasPromise()); | 19 DCHECK(initializer.hasPromise()); |
21 m_promise.set(initializer.promise().isolate(), | 20 m_promise.set(initializer.promise().isolate(), |
22 initializer.promise().v8Value()); | 21 initializer.promise().v8Value()); |
23 if (initializer.hasReason()) { | 22 if (initializer.hasReason()) { |
24 m_reason.set(initializer.reason().isolate(), | 23 m_reason.set(initializer.reason().isolate(), |
25 initializer.reason().v8Value()); | 24 initializer.reason().v8Value()); |
26 } | 25 } |
27 } | 26 } |
28 | 27 |
29 PromiseRejectionEvent::~PromiseRejectionEvent() {} | 28 PromiseRejectionEvent::~PromiseRejectionEvent() {} |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DEFINE_TRACE(PromiseRejectionEvent) { | 76 DEFINE_TRACE(PromiseRejectionEvent) { |
78 Event::trace(visitor); | 77 Event::trace(visitor); |
79 } | 78 } |
80 | 79 |
81 DEFINE_TRACE_WRAPPERS(PromiseRejectionEvent) { | 80 DEFINE_TRACE_WRAPPERS(PromiseRejectionEvent) { |
82 visitor->traceWrappers(m_promise); | 81 visitor->traceWrappers(m_promise); |
83 visitor->traceWrappers(m_reason); | 82 visitor->traceWrappers(m_reason); |
84 } | 83 } |
85 | 84 |
86 } // namespace blink | 85 } // namespace blink |
OLD | NEW |