Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: Source/modules/indexeddb/IDBObjectStore.cpp

Issue 1164493003: IndexedDB: Implementation of IDBObjectStore.getAllKeys(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idb-index-getallkeys-pt2
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/indexeddb/IDBObjectStore.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBObjectStore.cpp
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp
index 38d0345f24e73a26b2170124ef7b7e3f56e37059..2442189eec3ce20166feb68b903b30437d9137aa 100644
--- a/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -155,6 +155,43 @@ IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
return request;
}
+IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptValue& keyRange, ExceptionState& exceptionState)
+{
+ return getAllKeys(scriptState, keyRange, std::numeric_limits<uint32_t>::max(), exceptionState);
+}
+
+IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptValue& keyRange, unsigned long maxCount, ExceptionState& exceptionState)
+{
+ IDB_TRACE("IDBObjectStore::getAll");
+ if (!maxCount) {
+ exceptionState.throwTypeError(IDBDatabase::notValidMaxCountErrorMessage);
+ return 0;
+ }
+ if (isDeleted()) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished() || m_transaction->isFinishing()) {
+ exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
+ return 0;
+ }
+ if (!m_transaction->isActive()) {
+ exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
+ return 0;
+ }
+ IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->executionContext(), keyRange, exceptionState);
+ if (exceptionState.hadException())
+ return 0;
+ if (!backendDB()) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
+ return 0;
+ }
+
+ IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
+ backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr());
+ return request;
+}
+
static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetadata& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* indexKeys)
{
ASSERT(indexKeys);
« no previous file with comments | « Source/modules/indexeddb/IDBObjectStore.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698