| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/dom/DOMException.h" | 35 #include "core/dom/DOMException.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/events/EventQueue.h" | 38 #include "core/events/EventQueue.h" |
| 39 #include "modules/IndexedDBNames.h" | 39 #include "modules/IndexedDBNames.h" |
| 40 #include "modules/indexeddb/IDBCursorWithValue.h" | 40 #include "modules/indexeddb/IDBCursorWithValue.h" |
| 41 #include "modules/indexeddb/IDBDatabase.h" | 41 #include "modules/indexeddb/IDBDatabase.h" |
| 42 #include "modules/indexeddb/IDBEventDispatcher.h" | 42 #include "modules/indexeddb/IDBEventDispatcher.h" |
| 43 #include "modules/indexeddb/IDBTracing.h" | 43 #include "modules/indexeddb/IDBTracing.h" |
| 44 #include "modules/indexeddb/IDBValue.h" | 44 #include "modules/indexeddb/IDBValue.h" |
| 45 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
| 45 #include "platform/SharedBuffer.h" | 46 #include "platform/SharedBuffer.h" |
| 46 #include "public/platform/WebBlobInfo.h" | 47 #include "public/platform/WebBlobInfo.h" |
| 47 #include <memory> | 48 #include <memory> |
| 48 | 49 |
| 49 using blink::WebIDBCursor; | 50 using blink::WebIDBCursor; |
| 50 | 51 |
| 51 namespace blink { | 52 namespace blink { |
| 52 | 53 |
| 53 IDBRequest* IDBRequest::create(ScriptState* scriptState, | 54 IDBRequest* IDBRequest::create(ScriptState* scriptState, |
| 54 IDBAny* source, | 55 IDBAny* source, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 const String& IDBRequest::readyState() const { | 125 const String& IDBRequest::readyState() const { |
| 125 DCHECK(m_readyState == PENDING || m_readyState == DONE); | 126 DCHECK(m_readyState == PENDING || m_readyState == DONE); |
| 126 | 127 |
| 127 if (m_readyState == PENDING) | 128 if (m_readyState == PENDING) |
| 128 return IndexedDBNames::pending; | 129 return IndexedDBNames::pending; |
| 129 | 130 |
| 130 return IndexedDBNames::done; | 131 return IndexedDBNames::done; |
| 131 } | 132 } |
| 132 | 133 |
| 134 std::unique_ptr<WebIDBCallbacks> IDBRequest::createWebCallbacks() { |
| 135 DCHECK(!m_webCallbacks); |
| 136 std::unique_ptr<WebIDBCallbacks> callbacks = |
| 137 WebIDBCallbacksImpl::create(this); |
| 138 m_webCallbacks = callbacks.get(); |
| 139 return callbacks; |
| 140 } |
| 141 |
| 142 void IDBRequest::webCallbacksDestroyed() { |
| 143 DCHECK(m_webCallbacks); |
| 144 m_webCallbacks = nullptr; |
| 145 } |
| 146 |
| 133 void IDBRequest::abort() { | 147 void IDBRequest::abort() { |
| 134 DCHECK(!m_requestAborted); | 148 DCHECK(!m_requestAborted); |
| 135 if (m_contextStopped || !getExecutionContext()) | 149 if (m_contextStopped || !getExecutionContext()) |
| 136 return; | 150 return; |
| 137 DCHECK(m_readyState == PENDING || m_readyState == DONE); | 151 DCHECK(m_readyState == PENDING || m_readyState == DONE); |
| 138 if (m_readyState == DONE) | 152 if (m_readyState == DONE) |
| 139 return; | 153 return; |
| 140 | 154 |
| 141 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 155 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
| 142 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 156 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 402 } |
| 389 } | 403 } |
| 390 | 404 |
| 391 m_enqueuedEvents.clear(); | 405 m_enqueuedEvents.clear(); |
| 392 if (m_source) | 406 if (m_source) |
| 393 m_source->contextWillBeDestroyed(); | 407 m_source->contextWillBeDestroyed(); |
| 394 if (m_result) | 408 if (m_result) |
| 395 m_result->contextWillBeDestroyed(); | 409 m_result->contextWillBeDestroyed(); |
| 396 if (m_pendingCursor) | 410 if (m_pendingCursor) |
| 397 m_pendingCursor->contextWillBeDestroyed(); | 411 m_pendingCursor->contextWillBeDestroyed(); |
| 412 if (m_webCallbacks) { |
| 413 m_webCallbacks->detach(); |
| 414 m_webCallbacks = nullptr; |
| 415 } |
| 398 } | 416 } |
| 399 | 417 |
| 400 const AtomicString& IDBRequest::interfaceName() const { | 418 const AtomicString& IDBRequest::interfaceName() const { |
| 401 return EventTargetNames::IDBRequest; | 419 return EventTargetNames::IDBRequest; |
| 402 } | 420 } |
| 403 | 421 |
| 404 ExecutionContext* IDBRequest::getExecutionContext() const { | 422 ExecutionContext* IDBRequest::getExecutionContext() const { |
| 405 return ActiveDOMObject::getExecutionContext(); | 423 return ActiveDOMObject::getExecutionContext(); |
| 406 } | 424 } |
| 407 | 425 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 } | 554 } |
| 537 | 555 |
| 538 void IDBRequest::dequeueEvent(Event* event) { | 556 void IDBRequest::dequeueEvent(Event* event) { |
| 539 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 557 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
| 540 if (m_enqueuedEvents[i].get() == event) | 558 if (m_enqueuedEvents[i].get() == event) |
| 541 m_enqueuedEvents.remove(i); | 559 m_enqueuedEvents.remove(i); |
| 542 } | 560 } |
| 543 } | 561 } |
| 544 | 562 |
| 545 } // namespace blink | 563 } // namespace blink |
| OLD | NEW |