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 26 matching lines...) Expand all Loading... |
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 "platform/SharedBuffer.h" | 45 #include "platform/SharedBuffer.h" |
46 #include "public/platform/WebBlobInfo.h" | 46 #include "public/platform/WebBlobInfo.h" |
47 #include <memory> | |
48 | 47 |
49 using blink::WebIDBCursor; | 48 using blink::WebIDBCursor; |
50 | 49 |
51 namespace blink { | 50 namespace blink { |
52 | 51 |
53 IDBRequest* IDBRequest::create(ScriptState* scriptState, IDBAny* source, IDBTran
saction* transaction) | 52 IDBRequest* IDBRequest::create(ScriptState* scriptState, IDBAny* source, IDBTran
saction* transaction) |
54 { | 53 { |
55 IDBRequest* request = new IDBRequest(scriptState, source, transaction); | 54 IDBRequest* request = new IDBRequest(scriptState, source, transaction); |
56 request->suspendIfNeeded(); | 55 request->suspendIfNeeded(); |
57 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames
) are not associated with transactions. | 56 // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames
) are not associated with transactions. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 IDB_TRACE("IDBRequest::onSuccess(StringList)"); | 242 IDB_TRACE("IDBRequest::onSuccess(StringList)"); |
244 if (!shouldEnqueueEvent()) | 243 if (!shouldEnqueueEvent()) |
245 return; | 244 return; |
246 | 245 |
247 DOMStringList* domStringList = DOMStringList::create(DOMStringList::IndexedD
B); | 246 DOMStringList* domStringList = DOMStringList::create(DOMStringList::IndexedD
B); |
248 for (size_t i = 0; i < stringList.size(); ++i) | 247 for (size_t i = 0; i < stringList.size(); ++i) |
249 domStringList->append(stringList[i]); | 248 domStringList->append(stringList[i]); |
250 onSuccessInternal(IDBAny::create(domStringList)); | 249 onSuccessInternal(IDBAny::create(domStringList)); |
251 } | 250 } |
252 | 251 |
253 void IDBRequest::onSuccess(std::unique_ptr<WebIDBCursor> backend, IDBKey* key, I
DBKey* primaryKey, PassRefPtr<IDBValue> value) | 252 void IDBRequest::onSuccess(PassOwnPtr<WebIDBCursor> backend, IDBKey* key, IDBKey
* primaryKey, PassRefPtr<IDBValue> value) |
254 { | 253 { |
255 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); | 254 IDB_TRACE("IDBRequest::onSuccess(IDBCursor)"); |
256 if (!shouldEnqueueEvent()) | 255 if (!shouldEnqueueEvent()) |
257 return; | 256 return; |
258 | 257 |
259 ASSERT(!m_pendingCursor); | 258 ASSERT(!m_pendingCursor); |
260 IDBCursor* cursor = nullptr; | 259 IDBCursor* cursor = nullptr; |
261 switch (m_cursorType) { | 260 switch (m_cursorType) { |
262 case IndexedDB::CursorKeyOnly: | 261 case IndexedDB::CursorKeyOnly: |
263 cursor = IDBCursor::create(std::move(backend), m_cursorDirection, this,
m_source.get(), m_transaction.get()); | 262 cursor = IDBCursor::create(std::move(backend), m_cursorDirection, this,
m_source.get(), m_transaction.get()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 534 |
536 void IDBRequest::dequeueEvent(Event* event) | 535 void IDBRequest::dequeueEvent(Event* event) |
537 { | 536 { |
538 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 537 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
539 if (m_enqueuedEvents[i].get() == event) | 538 if (m_enqueuedEvents[i].get() == event) |
540 m_enqueuedEvents.remove(i); | 539 m_enqueuedEvents.remove(i); |
541 } | 540 } |
542 } | 541 } |
543 | 542 |
544 } // namespace blink | 543 } // namespace blink |
OLD | NEW |