| 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 <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 RejectedPromises::RejectedPromises() {} | 187 RejectedPromises::RejectedPromises() {} |
| 188 | 188 |
| 189 RejectedPromises::~RejectedPromises() {} | 189 RejectedPromises::~RejectedPromises() {} |
| 190 | 190 |
| 191 void RejectedPromises::rejectedWithNoHandler( | 191 void RejectedPromises::rejectedWithNoHandler( |
| 192 ScriptState* scriptState, | 192 ScriptState* scriptState, |
| 193 v8::PromiseRejectMessage data, | 193 v8::PromiseRejectMessage data, |
| 194 const String& errorMessage, | 194 const String& errorMessage, |
| 195 std::unique_ptr<SourceLocation> location, | 195 std::unique_ptr<SourceLocation> location, |
| 196 AccessControlStatus corsStatus) { | 196 AccessControlStatus corsStatus) { |
| 197 m_queue.append(Message::create(scriptState, data.GetPromise(), | 197 m_queue.push_back(Message::create(scriptState, data.GetPromise(), |
| 198 data.GetValue(), errorMessage, | 198 data.GetValue(), errorMessage, |
| 199 std::move(location), corsStatus)); | 199 std::move(location), corsStatus)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) { | 202 void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) { |
| 203 // First look it up in the pending messages and fast return, it'll be covered | 203 // First look it up in the pending messages and fast return, it'll be covered |
| 204 // by processQueue(). | 204 // by processQueue(). |
| 205 for (auto it = m_queue.begin(); it != m_queue.end(); ++it) { | 205 for (auto it = m_queue.begin(); it != m_queue.end(); ++it) { |
| 206 if (!(*it)->isCollected() && (*it)->hasPromise(data.GetPromise())) { | 206 if (!(*it)->isCollected() && (*it)->hasPromise(data.GetPromise())) { |
| 207 m_queue.remove(it); | 207 m_queue.remove(it); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10); | 278 m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 | 282 |
| 283 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) { | 283 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) { |
| 284 message->revoke(); | 284 message->revoke(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace blink | 287 } // namespace blink |
| OLD | NEW |