summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorcmumford <cmumford@chromium.org>2015-06-02 17:51:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-03 00:52:57 +0000
commit5065ab77fd2e4d9f4f7fe7a268037a789578455e (patch)
tree5a18e5696b58e57a5a32468369a13ed6023f0473 /content/browser
parent6e5d15268c5d75ba15189ce0a6050845068eb06b (diff)
downloadchromium_src-5065ab77fd2e4d9f4f7fe7a268037a789578455e.zip
chromium_src-5065ab77fd2e4d9f4f7fe7a268037a789578455e.tar.gz
chromium_src-5065ab77fd2e4d9f4f7fe7a268037a789578455e.tar.bz2
IndexedDB: Chrome implementation for IDBObjectStore.getAllKeys().
IDBObjectStore.getAllKeys() returns all primary keys (in one result) for a given query. This is an experimental web platform feature documented in the draft spec. at: https://w3c.github.io/IndexedDB/#widl-IDBObjectStore-getAllKeys-IDBRequest-any-query-unsigned-long-count To enable run Chrome with the enable-experimental-web-platform-features flag. BUG=492433 Review URL: https://codereview.chromium.org/1166503002 Cr-Commit-Position: refs/heads/master@{#332515}
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/indexed_db/indexed_db_database.cc60
1 files changed, 31 insertions, 29 deletions
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 5d6cae1..dbe8733 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -762,21 +762,32 @@ void IndexedDBDatabase::GetAllOperation(
scoped_ptr<IndexedDBBackingStore::Cursor> cursor;
- if (index_id == IndexedDBIndexMetadata::kInvalidId) {
- // Object Store Retrieval Operation
- cursor = backing_store_->OpenObjectStoreCursor(
- transaction->BackingStoreTransaction(), id(), object_store_id,
- *key_range, blink::WebIDBCursorDirectionNext, &s);
- } else if (cursor_type == indexed_db::CURSOR_KEY_ONLY) {
- // Index Value Retrieval Operation
- cursor = backing_store_->OpenIndexKeyCursor(
- transaction->BackingStoreTransaction(), id(), object_store_id, index_id,
- *key_range, blink::WebIDBCursorDirectionNext, &s);
+ if (cursor_type == indexed_db::CURSOR_KEY_ONLY) {
+ // Retrieving keys
+ if (index_id == IndexedDBIndexMetadata::kInvalidId) {
+ // Object Store: Key Retrieval Operation
+ cursor = backing_store_->OpenObjectStoreKeyCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id,
+ *key_range, blink::WebIDBCursorDirectionNext, &s);
+ } else {
+ // Index Value: (Primary Key) Retrieval Operation
+ cursor = backing_store_->OpenIndexKeyCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id,
+ index_id, *key_range, blink::WebIDBCursorDirectionNext, &s);
+ }
} else {
- // Index Referenced Value Retrieval Operation
- cursor = backing_store_->OpenIndexCursor(
- transaction->BackingStoreTransaction(), id(), object_store_id, index_id,
- *key_range, blink::WebIDBCursorDirectionNext, &s);
+ // Retrieving values
+ if (index_id == IndexedDBIndexMetadata::kInvalidId) {
+ // Object Store: Value Retrieval Operation
+ cursor = backing_store_->OpenObjectStoreCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id,
+ *key_range, blink::WebIDBCursorDirectionNext, &s);
+ } else {
+ // Object Store: Referenced Value Retrieval Operation
+ cursor = backing_store_->OpenIndexCursor(
+ transaction->BackingStoreTransaction(), id(), object_store_id,
+ index_id, *key_range, blink::WebIDBCursorDirectionNext, &s);
+ }
}
if (!s.ok()) {
@@ -830,23 +841,14 @@ void IndexedDBDatabase::GetAllOperation(
IndexedDBReturnValue return_value;
IndexedDBKey return_key;
- if (index_id == IndexedDBIndexMetadata::kInvalidId) {
- // Object Store Retrieval Operation
+ if (cursor_type == indexed_db::CURSOR_KEY_ONLY) {
+ return_key = cursor->primary_key();
+ } else {
+ // Retrieving values
return_value.swap(*cursor->value());
-
- if (generated_key)
+ if (!return_value.empty() && generated_key) {
return_value.primary_key = cursor->primary_key();
- } else {
- // Dealing with indexes
- if (cursor_type == indexed_db::CURSOR_KEY_ONLY) {
- return_key = cursor->primary_key();
- } else {
- // Index Referenced Value Retrieval Operation
- return_value.swap(*cursor->value());
- if (!return_value.empty() && generated_key) {
- return_value.primary_key = cursor->primary_key();
- return_value.key_path = object_store_metadata.key_path;
- }
+ return_value.key_path = object_store_metadata.key_path;
}
}