| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 190     v8::PromiseRejectMessage data, | 190     v8::PromiseRejectMessage data, | 
| 191     const String& errorMessage, | 191     const String& errorMessage, | 
| 192     std::unique_ptr<SourceLocation> location, | 192     std::unique_ptr<SourceLocation> location, | 
| 193     AccessControlStatus corsStatus) { | 193     AccessControlStatus corsStatus) { | 
| 194   m_queue.append(Message::create(scriptState, data.GetPromise(), | 194   m_queue.append(Message::create(scriptState, data.GetPromise(), | 
| 195                                  data.GetValue(), errorMessage, | 195                                  data.GetValue(), errorMessage, | 
| 196                                  std::move(location), corsStatus)); | 196                                  std::move(location), corsStatus)); | 
| 197 } | 197 } | 
| 198 | 198 | 
| 199 void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) { | 199 void RejectedPromises::handlerAdded(v8::PromiseRejectMessage data) { | 
| 200   // First look it up in the pending messages and fast return, it'll be covered 
     by processQueue(). | 200   // First look it up in the pending messages and fast return, it'll be covered | 
|  | 201   // by processQueue(). | 
| 201   for (auto it = m_queue.begin(); it != m_queue.end(); ++it) { | 202   for (auto it = m_queue.begin(); it != m_queue.end(); ++it) { | 
| 202     if (!(*it)->isCollected() && (*it)->hasPromise(data.GetPromise())) { | 203     if (!(*it)->isCollected() && (*it)->hasPromise(data.GetPromise())) { | 
| 203       m_queue.remove(it); | 204       m_queue.remove(it); | 
| 204       return; | 205       return; | 
| 205     } | 206     } | 
| 206   } | 207   } | 
| 207 | 208 | 
| 208   // Then look it up in the reported errors. | 209   // Then look it up in the reported errors. | 
| 209   for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { | 210   for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { | 
| 210     std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); | 211     std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 273         m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10); | 274         m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10); | 
| 274     } | 275     } | 
| 275   } | 276   } | 
| 276 } | 277 } | 
| 277 | 278 | 
| 278 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) { | 279 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) { | 
| 279   message->revoke(); | 280   message->revoke(); | 
| 280 } | 281 } | 
| 281 | 282 | 
| 282 }  // namespace blink | 283 }  // namespace blink | 
| OLD | NEW | 
|---|