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

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

Issue 322203004: Speed up IDB by trimming down the BlobChangeMaps. Check to see if we need each (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change Iterator to a Get Created 6 years, 6 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 | « content/browser/indexed_db/indexed_db_backing_store.h ('k') | 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 1e1d85b4cbbf9e277f005c83fe55a180ce7f00b9..67e9acb125b75d6cddbf4a3aebfc60de00d5484a 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -1884,11 +1884,13 @@ leveldb::Status IndexedDBBackingStore::PutRecord(
v.append(value.bits);
leveldb_transaction->Put(object_store_data_key, &v);
- transaction->PutBlobInfo(database_id,
- object_store_id,
- object_store_data_key,
- &value.blob_info,
- handles);
+ s = transaction->PutBlobInfoIfNeeded(database_id,
+ object_store_id,
+ object_store_data_key,
+ &value.blob_info,
+ handles);
+ if (!s.ok())
+ return s;
DCHECK(!handles->size());
const std::string exists_entry_key =
@@ -1937,8 +1939,10 @@ leveldb::Status IndexedDBBackingStore::DeleteRecord(
const std::string object_store_data_key = ObjectStoreDataKey::Encode(
database_id, object_store_id, record_identifier.primary_key());
leveldb_transaction->Remove(object_store_data_key);
- transaction->PutBlobInfo(
+ leveldb::Status s = transaction->PutBlobInfoIfNeeded(
database_id, object_store_id, object_store_data_key, NULL, NULL);
+ if (!s.ok())
+ return s;
const std::string exists_entry_key = ExistsEntryKey::Encode(
database_id, object_store_id, record_identifier.primary_key());
@@ -4145,6 +4149,37 @@ IndexedDBBackingStore::BlobChangeRecord::Clone() const {
return record.Pass();
}
+leveldb::Status IndexedDBBackingStore::Transaction::PutBlobInfoIfNeeded(
+ int64 database_id,
+ int64 object_store_id,
+ const std::string& object_store_data_key,
+ std::vector<IndexedDBBlobInfo>* blob_info,
+ ScopedVector<webkit_blob::BlobDataHandle>* handles) {
+ if (!blob_info || blob_info->empty()) {
+ blob_change_map_.erase(object_store_data_key);
+ incognito_blob_map_.erase(object_store_data_key);
+
+ BlobEntryKey blob_entry_key;
+ StringPiece leveldb_key_piece(object_store_data_key);
+ if (!BlobEntryKey::FromObjectStoreDataKey(&leveldb_key_piece,
+ &blob_entry_key)) {
+ NOTREACHED();
+ return InternalInconsistencyStatus();
+ }
+ std::string value;
+ bool found = false;
+ leveldb::Status s =
+ transaction()->Get(blob_entry_key.Encode(), &value, &found);
+ if (!s.ok())
+ return s;
+ if (!found)
+ return leveldb::Status::OK();
+ }
+ PutBlobInfo(
+ database_id, object_store_id, object_store_data_key, blob_info, handles);
+ return leveldb::Status::OK();
+}
+
// This is storing an info, even if empty, even if the previous key had no blob
// info that we know of. It duplicates a bunch of information stored in the
// leveldb transaction, but only w.r.t. the user keys altered--we don't keep the
« no previous file with comments | « content/browser/indexed_db/indexed_db_backing_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698