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