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

Unified Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 1147433002: IndexedDB: Added IDBIndex.getAll() implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaked getAll comments in indexed_db_database.cc 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
Index: content/browser/indexed_db/indexed_db_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 6fbc77f87b99ee7583e67c1ebe95268c2a52d882..d63661fc565776ad846e6e73250a278834bac3be 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -535,6 +535,7 @@ void IndexedDBDatabase::Abort(int64 transaction_id,
void IndexedDBDatabase::GetAll(int64 transaction_id,
int64 object_store_id,
+ int64 index_id,
scoped_ptr<IndexedDBKeyRange> key_range,
int64 max_count,
scoped_refptr<IndexedDBCallbacks> callbacks) {
@@ -548,7 +549,7 @@ void IndexedDBDatabase::GetAll(int64 transaction_id,
transaction->ScheduleTask(
base::Bind(&IndexedDBDatabase::GetAllOperation, this, object_store_id,
- Passed(&key_range), max_count, callbacks));
+ index_id, Passed(&key_range), max_count, callbacks));
}
void IndexedDBDatabase::Get(int64 transaction_id,
@@ -739,6 +740,7 @@ void IndexedDBDatabase::GetOperation(
void IndexedDBDatabase::GetAllOperation(
int64 object_store_id,
+ int64 index_id,
scoped_ptr<IndexedDBKeyRange> key_range,
int64 max_count,
scoped_refptr<IndexedDBCallbacks> callbacks,
@@ -756,10 +758,19 @@ void IndexedDBDatabase::GetAllOperation(
leveldb::Status s;
- scoped_ptr<IndexedDBBackingStore::Cursor> cursor =
- backing_store_->OpenObjectStoreCursor(
- transaction->BackingStoreTransaction(), id(), object_store_id,
- *key_range, blink::WebIDBCursorDirectionNext, &s);
+ scoped_ptr<IndexedDBBackingStore::Cursor> cursor;
+
+ if (index_id == IndexedDBIndexMetadata::kInvalidId) {
+ // ObjectStore
+ cursor = backing_store_->OpenObjectStoreCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id,
+ *key_range, blink::WebIDBCursorDirectionNext, &s);
+ } else {
+ // Index
+ cursor = backing_store_->OpenIndexCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id, index_id,
+ *key_range, blink::WebIDBCursorDirectionNext, &s);
+ }
if (!s.ok()) {
DLOG(ERROR) << "Unable to open cursor operation: " << s.ToString();
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.h ('k') | content/browser/indexed_db/indexed_db_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698