Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp

Issue 2083953002: Retain ref to RejectedPromises in RejectedPromises::handlerAdded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 m_queue.remove(it); 205 m_queue.remove(it);
206 return; 206 return;
207 } 207 }
208 } 208 }
209 209
210 // Then look it up in the reported errors. 210 // Then look it up in the reported errors.
211 for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) { 211 for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) {
212 std::unique_ptr<Message>& message = m_reportedAsErrors.at(i); 212 std::unique_ptr<Message>& message = m_reportedAsErrors.at(i);
213 if (!message->isCollected() && message->hasPromise(data.GetPromise())) { 213 if (!message->isCollected() && message->hasPromise(data.GetPromise())) {
214 message->makePromiseStrong(); 214 message->makePromiseStrong();
215 Platform::current()->currentThread()->scheduler()->timerTaskRunner() ->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::revokeNow, this, passed (std::move(message)))); 215 Platform::current()->currentThread()->scheduler()->timerTaskRunner() ->postTask(BLINK_FROM_HERE, WTF::bind(&RejectedPromises::revokeNow, RefPtr<Rejec tedPromises>(this), passed(std::move(message))));
216 m_reportedAsErrors.remove(i); 216 m_reportedAsErrors.remove(i);
217 return; 217 return;
218 } 218 }
219 } 219 }
220 } 220 }
221 221
222 std::unique_ptr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQ ueue() 222 std::unique_ptr<RejectedPromises::MessageQueue> RejectedPromises::createMessageQ ueue()
223 { 223 {
224 return wrapUnique(new MessageQueue()); 224 return wrapUnique(new MessageQueue());
225 } 225 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 } 268 }
269 } 269 }
270 270
271 void RejectedPromises::revokeNow(std::unique_ptr<Message> message) 271 void RejectedPromises::revokeNow(std::unique_ptr<Message> message)
272 { 272 {
273 message->revoke(); 273 message->revoke();
274 } 274 }
275 275
276 } // namespace blink 276 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698