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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 const AtomicString& IDBRequest::interfaceName() const | 393 const AtomicString& IDBRequest::interfaceName() const |
394 { | 394 { |
395 return EventTargetNames::IDBRequest; | 395 return EventTargetNames::IDBRequest; |
396 } | 396 } |
397 | 397 |
398 ExecutionContext* IDBRequest::executionContext() const | 398 ExecutionContext* IDBRequest::executionContext() const |
399 { | 399 { |
400 return ActiveDOMObject::executionContext(); | 400 return ActiveDOMObject::executionContext(); |
401 } | 401 } |
402 | 402 |
403 bool IDBRequest::dispatchEvent(PassRefPtr<Event> event) | 403 bool IDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) |
404 { | 404 { |
405 IDB_TRACE("IDBRequest::dispatchEvent"); | 405 IDB_TRACE("IDBRequest::dispatchEvent"); |
406 if (m_contextStopped || !executionContext()) | 406 if (m_contextStopped || !executionContext()) |
407 return false; | 407 return false; |
408 ASSERT(m_requestState.isValid()); | 408 ASSERT(m_requestState.isValid()); |
409 ASSERT(m_readyState == PENDING); | 409 ASSERT(m_readyState == PENDING); |
410 ASSERT(m_hasPendingActivity); | 410 ASSERT(m_hasPendingActivity); |
411 ASSERT(m_enqueuedEvents.size()); | 411 ASSERT(m_enqueuedEvents.size()); |
412 ASSERT(event->target() == this); | 412 ASSERT(event->target() == this); |
413 | 413 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 ASSERT(m_readyState == DONE); | 493 ASSERT(m_readyState == DONE); |
494 ASSERT(executionContext()); | 494 ASSERT(executionContext()); |
495 m_transaction.clear(); | 495 m_transaction.clear(); |
496 | 496 |
497 if (m_contextStopped) | 497 if (m_contextStopped) |
498 return; | 498 return; |
499 | 499 |
500 m_readyState = PENDING; | 500 m_readyState = PENDING; |
501 } | 501 } |
502 | 502 |
503 void IDBRequest::enqueueEvent(PassRefPtr<Event> event) | 503 void IDBRequest::enqueueEvent(PassRefPtrWillBeRawPtr<Event> event) |
504 { | 504 { |
505 ASSERT(m_readyState == PENDING || m_readyState == DONE); | 505 ASSERT(m_readyState == PENDING || m_readyState == DONE); |
506 | 506 |
507 if (m_contextStopped || !executionContext()) | 507 if (m_contextStopped || !executionContext()) |
508 return; | 508 return; |
509 | 509 |
510 ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent,
"When queueing event %s, m_readyState was %d", event->type().utf8().data(), m_re
adyState); | 510 ASSERT_WITH_MESSAGE(m_readyState == PENDING || m_didFireUpgradeNeededEvent,
"When queueing event %s, m_readyState was %d", event->type().utf8().data(), m_re
adyState); |
511 | 511 |
512 EventQueue* eventQueue = executionContext()->eventQueue(); | 512 EventQueue* eventQueue = executionContext()->eventQueue(); |
513 event->setTarget(this); | 513 event->setTarget(this); |
514 | 514 |
515 // Keep track of enqueued events in case we need to abort prior to dispatch, | 515 // Keep track of enqueued events in case we need to abort prior to dispatch, |
516 // in which case these must be cancelled. If the events not dispatched for | 516 // in which case these must be cancelled. If the events not dispatched for |
517 // other reasons they must be removed from this list via dequeueEvent(). | 517 // other reasons they must be removed from this list via dequeueEvent(). |
518 if (eventQueue->enqueueEvent(event.get())) | 518 if (eventQueue->enqueueEvent(event.get())) |
519 m_enqueuedEvents.append(event); | 519 m_enqueuedEvents.append(event); |
520 } | 520 } |
521 | 521 |
522 void IDBRequest::dequeueEvent(Event* event) | 522 void IDBRequest::dequeueEvent(Event* event) |
523 { | 523 { |
524 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 524 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
525 if (m_enqueuedEvents[i].get() == event) | 525 if (m_enqueuedEvents[i].get() == event) |
526 m_enqueuedEvents.remove(i); | 526 m_enqueuedEvents.remove(i); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 } // namespace WebCore | 530 } // namespace WebCore |
OLD | NEW |