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, IDBAny* source, IDBTran
saction* transaction) | 54 IDBRequest* IDBRequest::create(ScriptState* scriptState, IDBAny* source, IDBTran
saction* transaction) |
54 { | 55 { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 const String& IDBRequest::readyState() const | 125 const String& IDBRequest::readyState() const |
125 { | 126 { |
126 DCHECK(m_readyState == PENDING || m_readyState == DONE); | 127 DCHECK(m_readyState == PENDING || m_readyState == DONE); |
127 | 128 |
128 if (m_readyState == PENDING) | 129 if (m_readyState == PENDING) |
129 return IndexedDBNames::pending; | 130 return IndexedDBNames::pending; |
130 | 131 |
131 return IndexedDBNames::done; | 132 return IndexedDBNames::done; |
132 } | 133 } |
133 | 134 |
| 135 std::unique_ptr<WebIDBCallbacks> IDBRequest::createWebCallbacks() |
| 136 { |
| 137 DCHECK(!m_webCallbacks); |
| 138 std::unique_ptr<WebIDBCallbacks> callbacks = WebIDBCallbacksImpl::create(thi
s); |
| 139 m_webCallbacks = callbacks.get(); |
| 140 return callbacks; |
| 141 } |
| 142 |
| 143 void IDBRequest::webCallbacksDestroyed() |
| 144 { |
| 145 DCHECK(m_webCallbacks); |
| 146 m_webCallbacks = nullptr; |
| 147 } |
| 148 |
134 void IDBRequest::abort() | 149 void IDBRequest::abort() |
135 { | 150 { |
136 DCHECK(!m_requestAborted); | 151 DCHECK(!m_requestAborted); |
137 if (m_contextStopped || !getExecutionContext()) | 152 if (m_contextStopped || !getExecutionContext()) |
138 return; | 153 return; |
139 DCHECK(m_readyState == PENDING || m_readyState == DONE); | 154 DCHECK(m_readyState == PENDING || m_readyState == DONE); |
140 if (m_readyState == DONE) | 155 if (m_readyState == DONE) |
141 return; | 156 return; |
142 | 157 |
143 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); | 158 EventQueue* eventQueue = getExecutionContext()->getEventQueue(); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 411 } |
397 } | 412 } |
398 | 413 |
399 m_enqueuedEvents.clear(); | 414 m_enqueuedEvents.clear(); |
400 if (m_source) | 415 if (m_source) |
401 m_source->contextWillBeDestroyed(); | 416 m_source->contextWillBeDestroyed(); |
402 if (m_result) | 417 if (m_result) |
403 m_result->contextWillBeDestroyed(); | 418 m_result->contextWillBeDestroyed(); |
404 if (m_pendingCursor) | 419 if (m_pendingCursor) |
405 m_pendingCursor->contextWillBeDestroyed(); | 420 m_pendingCursor->contextWillBeDestroyed(); |
| 421 if (m_webCallbacks) { |
| 422 m_webCallbacks->detach(); |
| 423 m_webCallbacks = nullptr; |
| 424 } |
406 } | 425 } |
407 | 426 |
408 const AtomicString& IDBRequest::interfaceName() const | 427 const AtomicString& IDBRequest::interfaceName() const |
409 { | 428 { |
410 return EventTargetNames::IDBRequest; | 429 return EventTargetNames::IDBRequest; |
411 } | 430 } |
412 | 431 |
413 ExecutionContext* IDBRequest::getExecutionContext() const | 432 ExecutionContext* IDBRequest::getExecutionContext() const |
414 { | 433 { |
415 return ActiveDOMObject::getExecutionContext(); | 434 return ActiveDOMObject::getExecutionContext(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 554 |
536 void IDBRequest::dequeueEvent(Event* event) | 555 void IDBRequest::dequeueEvent(Event* event) |
537 { | 556 { |
538 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 557 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
539 if (m_enqueuedEvents[i].get() == event) | 558 if (m_enqueuedEvents[i].get() == event) |
540 m_enqueuedEvents.remove(i); | 559 m_enqueuedEvents.remove(i); |
541 } | 560 } |
542 } | 561 } |
543 | 562 |
544 } // namespace blink | 563 } // namespace blink |
OLD | NEW |