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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (cursorToNotify) | 428 if (cursorToNotify) |
429 cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimary
Key.release(), m_cursorValue.release()); | 429 cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimary
Key.release(), m_cursorValue.release()); |
430 } | 430 } |
431 | 431 |
432 if (event->type() == EventTypeNames::upgradeneeded) { | 432 if (event->type() == EventTypeNames::upgradeneeded) { |
433 ASSERT(!m_didFireUpgradeNeededEvent); | 433 ASSERT(!m_didFireUpgradeNeededEvent); |
434 m_didFireUpgradeNeededEvent = true; | 434 m_didFireUpgradeNeededEvent = true; |
435 } | 435 } |
436 | 436 |
437 // FIXME: When we allow custom event dispatching, this will probably need to
change. | 437 // FIXME: When we allow custom event dispatching, this will probably need to
change. |
438 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().str
ing().utf8().data()); | 438 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()); |
439 const bool setTransactionActive = m_transaction && (event->type() == EventTy
peNames::success || event->type() == EventTypeNames::upgradeneeded || (event->ty
pe() == EventTypeNames::error && !m_requestAborted)); | 439 const bool setTransactionActive = m_transaction && (event->type() == EventTy
peNames::success || event->type() == EventTypeNames::upgradeneeded || (event->ty
pe() == EventTypeNames::error && !m_requestAborted)); |
440 | 440 |
441 if (setTransactionActive) | 441 if (setTransactionActive) |
442 m_transaction->setActive(true); | 442 m_transaction->setActive(true); |
443 | 443 |
444 bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets)
; | 444 bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets)
; |
445 | 445 |
446 if (m_transaction) { | 446 if (m_transaction) { |
447 if (m_readyState == DONE) | 447 if (m_readyState == DONE) |
448 m_transaction->unregisterRequest(this); | 448 m_transaction->unregisterRequest(this); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 m_readyState = PENDING; | 493 m_readyState = PENDING; |
494 } | 494 } |
495 | 495 |
496 void IDBRequest::enqueueEvent(PassRefPtr<Event> event) | 496 void IDBRequest::enqueueEvent(PassRefPtr<Event> event) |
497 { | 497 { |
498 ASSERT(m_readyState == PENDING || m_readyState == DONE); | 498 ASSERT(m_readyState == PENDING || m_readyState == DONE); |
499 | 499 |
500 if (m_contextStopped || !executionContext()) | 500 if (m_contextStopped || !executionContext()) |
501 return; | 501 return; |
502 | 502 |
503 ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent,
"When queueing event %s, m_readyState was %d", event->type().string().utf8().dat
a(), m_readyState); | 503 ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent,
"When queueing event %s, m_readyState was %d", event->type().utf8().data(), m_re
adyState); |
504 | 504 |
505 EventQueue* eventQueue = executionContext()->eventQueue(); | 505 EventQueue* eventQueue = executionContext()->eventQueue(); |
506 event->setTarget(this); | 506 event->setTarget(this); |
507 | 507 |
508 // Keep track of enqueued events in case we need to abort prior to dispatch, | 508 // Keep track of enqueued events in case we need to abort prior to dispatch, |
509 // in which case these must be cancelled. If the events not dispatched for | 509 // in which case these must be cancelled. If the events not dispatched for |
510 // other reasons they must be removed from this list via dequeueEvent(). | 510 // other reasons they must be removed from this list via dequeueEvent(). |
511 if (eventQueue->enqueueEvent(event.get())) | 511 if (eventQueue->enqueueEvent(event.get())) |
512 m_enqueuedEvents.append(event); | 512 m_enqueuedEvents.append(event); |
513 } | 513 } |
514 | 514 |
515 void IDBRequest::dequeueEvent(Event* event) | 515 void IDBRequest::dequeueEvent(Event* event) |
516 { | 516 { |
517 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 517 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
518 if (m_enqueuedEvents[i].get() == event) | 518 if (m_enqueuedEvents[i].get() == event) |
519 m_enqueuedEvents.remove(i); | 519 m_enqueuedEvents.remove(i); |
520 } | 520 } |
521 } | 521 } |
522 | 522 |
523 } // namespace WebCore | 523 } // namespace WebCore |
OLD | NEW |