OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 DCHECK_EQ(m_readyState, PENDING); | 424 DCHECK_EQ(m_readyState, PENDING); |
425 DCHECK(m_hasPendingActivity); | 425 DCHECK(m_hasPendingActivity); |
426 DCHECK(m_enqueuedEvents.size()); | 426 DCHECK(m_enqueuedEvents.size()); |
427 DCHECK_EQ(event->target(), this); | 427 DCHECK_EQ(event->target(), this); |
428 | 428 |
429 if (event->type() != EventTypeNames::blocked) | 429 if (event->type() != EventTypeNames::blocked) |
430 m_readyState = DONE; | 430 m_readyState = DONE; |
431 dequeueEvent(event); | 431 dequeueEvent(event); |
432 | 432 |
433 HeapVector<Member<EventTarget>> targets; | 433 HeapVector<Member<EventTarget>> targets; |
434 targets.append(this); | 434 targets.push_back(this); |
435 if (m_transaction && !m_preventPropagation) { | 435 if (m_transaction && !m_preventPropagation) { |
436 targets.append(m_transaction); | 436 targets.push_back(m_transaction); |
437 // If there ever are events that are associated with a database but | 437 // If there ever are events that are associated with a database but |
438 // that do not have a transaction, then this will not work and we need | 438 // that do not have a transaction, then this will not work and we need |
439 // this object to actually hold a reference to the database (to ensure | 439 // this object to actually hold a reference to the database (to ensure |
440 // it stays alive). | 440 // it stays alive). |
441 targets.append(m_transaction->db()); | 441 targets.push_back(m_transaction->db()); |
442 } | 442 } |
443 | 443 |
444 // Cursor properties should not be updated until the success event is being | 444 // Cursor properties should not be updated until the success event is being |
445 // dispatched. | 445 // dispatched. |
446 IDBCursor* cursorToNotify = nullptr; | 446 IDBCursor* cursorToNotify = nullptr; |
447 if (event->type() == EventTypeNames::success) { | 447 if (event->type() == EventTypeNames::success) { |
448 cursorToNotify = getResultCursor(); | 448 cursorToNotify = getResultCursor(); |
449 if (cursorToNotify) | 449 if (cursorToNotify) |
450 cursorToNotify->setValueReady(m_cursorKey.release(), | 450 cursorToNotify->setValueReady(m_cursorKey.release(), |
451 m_cursorPrimaryKey.release(), | 451 m_cursorPrimaryKey.release(), |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 << "When queueing event " << event->type() << ", m_readyState was " | 539 << "When queueing event " << event->type() << ", m_readyState was " |
540 << m_readyState; | 540 << m_readyState; |
541 | 541 |
542 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 542 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
543 event->setTarget(this); | 543 event->setTarget(this); |
544 | 544 |
545 // Keep track of enqueued events in case we need to abort prior to dispatch, | 545 // Keep track of enqueued events in case we need to abort prior to dispatch, |
546 // in which case these must be cancelled. If the events not dispatched for | 546 // in which case these must be cancelled. If the events not dispatched for |
547 // other reasons they must be removed from this list via dequeueEvent(). | 547 // other reasons they must be removed from this list via dequeueEvent(). |
548 if (eventQueue->enqueueEvent(event)) | 548 if (eventQueue->enqueueEvent(event)) |
549 m_enqueuedEvents.append(event); | 549 m_enqueuedEvents.push_back(event); |
550 } | 550 } |
551 | 551 |
552 void IDBRequest::dequeueEvent(Event* event) { | 552 void IDBRequest::dequeueEvent(Event* event) { |
553 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 553 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
554 if (m_enqueuedEvents[i].get() == event) | 554 if (m_enqueuedEvents[i].get() == event) |
555 m_enqueuedEvents.remove(i); | 555 m_enqueuedEvents.remove(i); |
556 } | 556 } |
557 } | 557 } |
558 | 558 |
559 } // namespace blink | 559 } // namespace blink |
OLD | NEW |