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

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

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle the rest of Josh's feedback. Created 7 years 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.h
diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.h b/content/browser/indexed_db/indexed_db_leveldb_coding.h
index 8d0c78047a72347b37785170e7e42f3f8eb8e60c..256b3e1711edccf909ace0a5e80fee6305e8f156 100644
--- a/content/browser/indexed_db/indexed_db_leveldb_coding.h
+++ b/content/browser/indexed_db/indexed_db_leveldb_coding.h
@@ -96,6 +96,7 @@ class KeyPrefix {
DATABASE_METADATA,
OBJECT_STORE_DATA,
EXISTS_ENTRY,
+ BLOB_ENTRY,
jsbell 2013/12/20 00:44:20 Needs to be appended, since these are serialized -
ericu 2014/02/20 00:50:29 Done.
INDEX_DATA,
INVALID_TYPE
};
@@ -171,6 +172,16 @@ class DataVersionKey {
static std::string Encode();
};
+class BlobJournalKey {
+ public:
+ static std::string Encode();
+};
+
+class LiveBlobJournalKey {
+ public:
+ static std::string Encode();
+};
+
class DatabaseFreeListKey {
public:
DatabaseFreeListKey();
@@ -210,9 +221,15 @@ class DatabaseMetaDataKey {
USER_VERSION = 2,
MAX_OBJECT_STORE_ID = 3,
USER_INT_VERSION = 4,
- MAX_SIMPLE_METADATA_TYPE = 5
+ BLOB_KEY_GENERATOR_CURRENT_NUMBER = 5,
+ MAX_SIMPLE_METADATA_TYPE = 6
};
+ static const int64 kAllBlobsKey = 1;
+ static const int64 kBlobKeyGeneratorInitialNumber = 2;
+ static const int64 kInvalidBlobKey = -1; // All keys <= 0 are invalid.
+
+ static bool IsValidBlobKey(int64 blobKey);
CONTENT_EXPORT static std::string Encode(int64 database_id,
MetaDataType type);
};
@@ -383,6 +400,37 @@ class ExistsEntryKey {
DISALLOW_COPY_AND_ASSIGN(ExistsEntryKey);
};
+class BlobEntryKey {
+ public:
+ BlobEntryKey() : database_id_(0), object_store_id_(0) {}
+ static bool Decode(base::StringPiece* slice, BlobEntryKey* result);
+ static bool FromObjectStoreDataKey(base::StringPiece* slice,
+ BlobEntryKey* result);
+ static std::string ReencodeToObjectStoreDataKey(base::StringPiece* slice);
+ static std::string EncodeMinForObjectStore(int64 database_id,
+ int64 object_store_id);
+ static std::string EncodeMaxForObjectStore(int64 database_id,
+ int64 object_store_id);
+ static std::string Encode(int64 database_id,
+ int64 object_store_id,
+ const IndexedDBKey& user_key);
+ std::string Encode() const;
+ int64 database_id() const { return database_id_; }
+ int64 object_store_id() const { return object_store_id_; }
+ int Compare(const BlobEntryKey& other, bool* ok);
+
+ static const int64 kSpecialIndexNumber;
+
+ private:
+ static std::string Encode(int64 database_id,
+ int64 object_store_id,
+ const std::string& encoded_user_key);
+ int64 database_id_;
+ int64 object_store_id_;
+ // This is the user's ObjectStoreDataKey, not the BlobEntryKey itself.
+ std::string encoded_user_key_;
+};
+
class IndexDataKey {
public:
IndexDataKey();

Powered by Google App Engine
This is Rietveld 408576698