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

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

Issue 264483002: This is the implementation of the primary and secondary blob journals for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Export kAllBlobsKey Created 6 years, 8 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_leveldb_coding.cc
diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.cc b/content/browser/indexed_db/indexed_db_leveldb_coding.cc
index 44556833f69543eb6ee523724a9c01e9dc8e4f44..2de9b6d585db798e7ecc3fee710bae07de6e5bc0 100644
--- a/content/browser/indexed_db/indexed_db_leveldb_coding.cc
+++ b/content/browser/indexed_db/indexed_db_leveldb_coding.cc
@@ -375,6 +375,14 @@ void EncodeIDBKeyPath(const IndexedDBKeyPath& value, std::string* into) {
}
}
+void EncodeBlobJournal(const BlobJournalType& journal, std::string* into) {
+ BlobJournalType::const_iterator iter;
+ for (iter = journal.begin(); iter != journal.end(); ++iter) {
+ EncodeVarInt(iter->first, into);
+ EncodeVarInt(iter->second, into);
+ }
+}
+
bool DecodeByte(StringPiece* slice, unsigned char* value) {
if (slice->empty())
return false;
@@ -607,6 +615,27 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) {
return false;
}
+bool DecodeBlobJournal(StringPiece* slice, BlobJournalType* journal) {
+ BlobJournalType output;
+ while (!slice->empty()) {
+ int64 database_id = -1;
+ int64 blob_key = -1;
+ if (!DecodeVarInt(slice, &database_id))
+ return false;
+ if (!KeyPrefix::IsValidDatabaseId(database_id))
+ return false;
+ if (!DecodeVarInt(slice, &blob_key))
+ return false;
+ if (!DatabaseMetaDataKey::IsValidBlobKey(blob_key) &&
+ (blob_key != DatabaseMetaDataKey::kAllBlobsKey)) {
+ return false;
+ }
+ output.push_back(std::make_pair(database_id, blob_key));
+ }
+ journal->swap(output);
+ return true;
+}
+
bool ConsumeEncodedIDBKey(StringPiece* slice) {
unsigned char type = (*slice)[0];
slice->remove_prefix(1);

Powered by Google App Engine
This is Rietveld 408576698