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

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

Issue 1387773002: Oilpan: fix build after r352251. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h ('k') | 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 "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/RejectedPromises.h" 6 #include "bindings/core/v8/RejectedPromises.h"
7 7
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 auto& message = m_reportedAsErrors.at(i); 220 auto& message = m_reportedAsErrors.at(i);
221 if (!message->isCollected() && message->hasPromise(data.GetPromise())) { 221 if (!message->isCollected() && message->hasPromise(data.GetPromise())) {
222 message->makePromiseStrong(); 222 message->makePromiseStrong();
223 Platform::current()->currentThread()->scheduler()->timerTaskRunner() ->postTask(FROM_HERE, new Task(bind(&RejectedPromises::revokeNow, this, message. release()))); 223 Platform::current()->currentThread()->scheduler()->timerTaskRunner() ->postTask(FROM_HERE, new Task(bind(&RejectedPromises::revokeNow, this, message. release())));
224 m_reportedAsErrors.remove(i); 224 m_reportedAsErrors.remove(i);
225 return; 225 return;
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 PassOwnPtrWillBeRawPtr<RejectedPromises::MessageQueue> RejectedPromises::createM essageQueue()
231 {
232 return adoptPtrWillBeNoop(new MessageQueue());
233 }
234
230 void RejectedPromises::dispose() 235 void RejectedPromises::dispose()
231 { 236 {
232 if (!m_queue.isEmpty()) { 237 if (m_queue.isEmpty())
233 OwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>> queue = adoptPtr(new WillBeHeapDeque<OwnPtrWillBeMember<Message>>()); 238 return;
234 queue->swap(m_queue); 239
235 processQueueNow(queue.release()); 240 OwnPtrWillBeRawPtr<MessageQueue> queue = createMessageQueue();
236 } 241 queue->swap(m_queue);
242 processQueueNow(queue.release());
237 } 243 }
238 244
239 void RejectedPromises::processQueue() 245 void RejectedPromises::processQueue()
240 { 246 {
241 if (m_queue.isEmpty()) 247 if (m_queue.isEmpty())
242 return; 248 return;
243 OwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>> queue = ado ptPtr(new WillBeHeapDeque<OwnPtrWillBeMember<Message>>()); 249
250 OwnPtrWillBeRawPtr<MessageQueue> queue = createMessageQueue();
244 queue->swap(m_queue); 251 queue->swap(m_queue);
245 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTa sk(FROM_HERE, new Task(bind(&RejectedPromises::processQueueNow, this, queue.rele ase()))); 252 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTa sk(FROM_HERE, new Task(bind(&RejectedPromises::processQueueNow, this, queue.rele ase())));
246 } 253 }
247 254
248 void RejectedPromises::processQueueNow(PassOwnPtrWillBeRawPtr<WillBeHeapDeque<Ow nPtrWillBeMember<Message>>> queue) 255 void RejectedPromises::processQueueNow(PassOwnPtrWillBeRawPtr<MessageQueue> queu e)
249 { 256 {
250 // Remove collected handlers. 257 // Remove collected handlers.
251 for (size_t i = 0; i < m_reportedAsErrors.size();) { 258 for (size_t i = 0; i < m_reportedAsErrors.size();) {
252 if (m_reportedAsErrors.at(i)->isCollected()) 259 if (m_reportedAsErrors.at(i)->isCollected())
253 m_reportedAsErrors.remove(i); 260 m_reportedAsErrors.remove(i);
254 else 261 else
255 ++i; 262 ++i;
256 } 263 }
257 264
258 while (!queue->isEmpty()) { 265 while (!queue->isEmpty()) {
259 OwnPtrWillBeRawPtr<Message> message = queue->takeFirst(); 266 OwnPtrWillBeRawPtr<Message> message = queue->takeFirst();
260 if (!message->hasHandler()) { 267 if (!message->hasHandler()) {
261 message->report(); 268 message->report();
262 message->makePromiseWeak(); 269 message->makePromiseWeak();
263 m_reportedAsErrors.append(message.release()); 270 m_reportedAsErrors.append(message.release());
264 if (m_reportedAsErrors.size() > maxReportedHandlersPendingResolution ) 271 if (m_reportedAsErrors.size() > maxReportedHandlersPendingResolution )
265 m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolutio n / 10); 272 m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolutio n / 10);
266 } 273 }
267 } 274 }
268 } 275 }
269 276
270 void RejectedPromises::revokeNow(PassOwnPtrWillBeRawPtr<Message> message) 277 void RejectedPromises::revokeNow(PassOwnPtrWillBeRawPtr<Message> message)
271 { 278 {
272 message->revoke(); 279 message->revoke();
273 } 280 }
274 281
275 } // namespace blink 282 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698