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 "bindings/core/v8/RejectedPromises.h" | 5 #include "bindings/core/v8/RejectedPromises.h" |
6 | 6 |
7 #include "bindings/core/v8/ScopedPersistent.h" | 7 #include "bindings/core/v8/ScopedPersistent.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 PromiseRejectionEventInit init; | 100 PromiseRejectionEventInit init; |
101 init.setPromise(ScriptPromise(m_scriptState, value)); | 101 init.setPromise(ScriptPromise(m_scriptState, value)); |
102 init.setReason(ScriptValue(m_scriptState, reason)); | 102 init.setReason(ScriptValue(m_scriptState, reason)); |
103 PromiseRejectionEvent* event = PromiseRejectionEvent::create(m_scrip
tState, EventTypeNames::rejectionhandled, init); | 103 PromiseRejectionEvent* event = PromiseRejectionEvent::create(m_scrip
tState, EventTypeNames::rejectionhandled, init); |
104 target->dispatchEvent(event); | 104 target->dispatchEvent(event); |
105 } | 105 } |
106 | 106 |
107 if (m_shouldLogToConsole && m_promiseRejectionId) { | 107 if (m_shouldLogToConsole && m_promiseRejectionId) { |
108 V8PerIsolateData* data = V8PerIsolateData::from(m_scriptState->isola
te()); | 108 V8PerIsolateData* data = V8PerIsolateData::from(m_scriptState->isola
te()); |
109 if (data->threadDebugger()) | 109 if (data->threadDebugger()) |
110 data->threadDebugger()->debugger()->promiseRejectionRevoked(m_sc
riptState->context(), m_promiseRejectionId); | 110 data->threadDebugger()->promiseRejectionRevoked(m_scriptState->c
ontext(), m_promiseRejectionId); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void makePromiseWeak() | 114 void makePromiseWeak() |
115 { | 115 { |
116 ASSERT(!m_promise.isEmpty() && !m_promise.isWeak()); | 116 ASSERT(!m_promise.isEmpty() && !m_promise.isWeak()); |
117 m_promise.setWeak(this, &Message::didCollectPromise); | 117 m_promise.setWeak(this, &Message::didCollectPromise); |
118 m_exception.setWeak(this, &Message::didCollectException); | 118 m_exception.setWeak(this, &Message::didCollectException); |
119 } | 119 } |
120 | 120 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) | 258 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) |
259 { | 259 { |
260 message->revoke(); | 260 message->revoke(); |
261 } | 261 } |
262 | 262 |
263 } // namespace blink | 263 } // namespace blink |
OLD | NEW |