| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 m_queue.push_back(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.erase(it); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Then look it up in the reported errors. | 212 // Then look it up in the reported errors. |
| 213 for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { | 213 for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { |
| 214 std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); | 214 std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); |
| 215 if (!message->isCollected() && message->hasPromise(data.GetPromise())) { | 215 if (!message->isCollected() && message->hasPromise(data.GetPromise())) { |
| 216 message->makePromiseStrong(); | 216 message->makePromiseStrong(); |
| 217 Platform::current() | 217 Platform::current() |
| (...skipping 60 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 |