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

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

Issue 565023002: IndexedDB: Switched two Iterator::Seek calls to Transaction::Get. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_backing_store.cc
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc
index c27216b20bd7527d79d90b5035b2762f056a90cc..0f6c85fb43d874ce563a3a086cccce55319f667b 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -2678,13 +2678,14 @@ leveldb::Status IndexedDBBackingStore::Transaction::GetBlobInfoForRecord(
NOTREACHED();
return InternalInconsistencyStatus();
}
- scoped_ptr<LevelDBIterator> it = transaction()->CreateIterator();
std::string encoded_key = blob_entry_key.Encode();
- leveldb::Status s = it->Seek(encoded_key);
+ bool found;
+ std::string encoded_value;
+ leveldb::Status s = transaction()->Get(encoded_key, &encoded_value, &found);
if (!s.ok())
return s;
- if (it->IsValid() && CompareKeys(it->Key(), encoded_key) == 0) {
- if (!DecodeBlobData(it->Value().as_string(), &value->blob_info)) {
+ if (found) {
+ if (!DecodeBlobData(encoded_value, &value->blob_info)) {
INTERNAL_READ_ERROR(GET_BLOB_INFO_FOR_RECORD);
return InternalInconsistencyStatus();
}
@@ -3981,7 +3982,6 @@ bool IndexedDBBackingStore::Transaction::CollectBlobFilesToRemove() {
// Look up all old files to remove as part of the transaction, store their
// names in blobs_to_remove_, and remove their old blob data entries.
if (iter != blob_change_map_.end()) {
- scoped_ptr<LevelDBIterator> db_iter = transaction_->CreateIterator();
for (; iter != blob_change_map_.end(); ++iter) {
BlobEntryKey blob_entry_key;
StringPiece key_piece(iter->second->key());
@@ -3996,11 +3996,13 @@ bool IndexedDBBackingStore::Transaction::CollectBlobFilesToRemove() {
else
DCHECK_EQ(database_id_, blob_entry_key.database_id());
std::string blob_entry_key_bytes = blob_entry_key.Encode();
- db_iter->Seek(blob_entry_key_bytes);
- if (db_iter->IsValid() &&
- !CompareKeys(db_iter->Key(), blob_entry_key_bytes)) {
+ bool found;
+ std::string blob_entry_value_bytes;
+ leveldb::Status s = transaction_->Get(
+ blob_entry_key_bytes, &blob_entry_value_bytes, &found);
+ if (s.ok() && found) {
std::vector<IndexedDBBlobInfo> blob_info;
- if (!DecodeBlobData(db_iter->Value().as_string(), &blob_info)) {
+ if (!DecodeBlobData(blob_entry_value_bytes, &blob_info)) {
INTERNAL_READ_ERROR_UNTESTED(TRANSACTION_COMMIT_METHOD);
transaction_ = NULL;
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698