| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (cursorToNotify) | 445 if (cursorToNotify) |
| 446 cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimary
Key.release(), m_cursorValue.release()); | 446 cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimary
Key.release(), m_cursorValue.release()); |
| 447 } | 447 } |
| 448 | 448 |
| 449 if (event->type() == EventTypeNames::upgradeneeded) { | 449 if (event->type() == EventTypeNames::upgradeneeded) { |
| 450 ASSERT(!m_didFireUpgradeNeededEvent); | 450 ASSERT(!m_didFireUpgradeNeededEvent); |
| 451 m_didFireUpgradeNeededEvent = true; | 451 m_didFireUpgradeNeededEvent = true; |
| 452 } | 452 } |
| 453 | 453 |
| 454 // FIXME: When we allow custom event dispatching, this will probably need to
change. | 454 // FIXME: When we allow custom event dispatching, this will probably need to
change. |
| 455 ASSERT_WITH_MESSAGE(event->type() == EventTypeNames::success || event->type(
) == EventTypeNames::error || event->type() == EventTypeNames::blocked || event-
>type() == EventTypeNames::upgradeneeded, "event type was %s", event->type().utf
8().data()); | 455 DCHECK(event->type() == EventTypeNames::success || event->type() == EventTyp
eNames::error || event->type() == EventTypeNames::blocked || event->type() == Ev
entTypeNames::upgradeneeded) << "event type was " << event->type(); |
| 456 const bool setTransactionActive = m_transaction && (event->type() == EventTy
peNames::success || event->type() == EventTypeNames::upgradeneeded || (event->ty
pe() == EventTypeNames::error && !m_requestAborted)); | 456 const bool setTransactionActive = m_transaction && (event->type() == EventTy
peNames::success || event->type() == EventTypeNames::upgradeneeded || (event->ty
pe() == EventTypeNames::error && !m_requestAborted)); |
| 457 | 457 |
| 458 if (setTransactionActive) | 458 if (setTransactionActive) |
| 459 m_transaction->setActive(true); | 459 m_transaction->setActive(true); |
| 460 | 460 |
| 461 DispatchEventResult dispatchResult = IDBEventDispatcher::dispatch(event.get(
), targets); | 461 DispatchEventResult dispatchResult = IDBEventDispatcher::dispatch(event.get(
), targets); |
| 462 | 462 |
| 463 if (m_transaction) { | 463 if (m_transaction) { |
| 464 if (m_readyState == DONE) | 464 if (m_readyState == DONE) |
| 465 m_transaction->unregisterRequest(this); | 465 m_transaction->unregisterRequest(this); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 m_readyState = PENDING; | 510 m_readyState = PENDING; |
| 511 } | 511 } |
| 512 | 512 |
| 513 void IDBRequest::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) | 513 void IDBRequest::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) |
| 514 { | 514 { |
| 515 ASSERT(m_readyState == PENDING || m_readyState == DONE); | 515 ASSERT(m_readyState == PENDING || m_readyState == DONE); |
| 516 | 516 |
| 517 if (m_contextStopped || !getExecutionContext()) | 517 if (m_contextStopped || !getExecutionContext()) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent,
"When queueing event %s, m_readyState was %d", event->type().utf8().data(), m_re
adyState); | 520 DCHECK(m_readyState == PENDING || m_didFireUpgradeNeededEvent) << "When queu
eing event " << event->type() << ", m_readyState was " << m_readyState; |
| 521 | 521 |
| 522 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 522 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
| 523 event->setTarget(this); | 523 event->setTarget(this); |
| 524 | 524 |
| 525 // Keep track of enqueued events in case we need to abort prior to dispatch, | 525 // Keep track of enqueued events in case we need to abort prior to dispatch, |
| 526 // in which case these must be cancelled. If the events not dispatched for | 526 // in which case these must be cancelled. If the events not dispatched for |
| 527 // other reasons they must be removed from this list via dequeueEvent(). | 527 // other reasons they must be removed from this list via dequeueEvent(). |
| 528 if (eventQueue->enqueueEvent(event.get())) | 528 if (eventQueue->enqueueEvent(event.get())) |
| 529 m_enqueuedEvents.append(event); | 529 m_enqueuedEvents.append(event); |
| 530 } | 530 } |
| 531 | 531 |
| 532 void IDBRequest::dequeueEvent(Event* event) | 532 void IDBRequest::dequeueEvent(Event* event) |
| 533 { | 533 { |
| 534 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 534 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 535 if (m_enqueuedEvents[i].get() == event) | 535 if (m_enqueuedEvents[i].get() == event) |
| 536 m_enqueuedEvents.remove(i); | 536 m_enqueuedEvents.remove(i); |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace blink | 540 } // namespace blink |
| OLD | NEW |