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

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

Issue 198133002: Add the leveldb coding changes for IDB blob support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Josh's feedback Created 6 years, 9 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 | content/browser/indexed_db/indexed_db_leveldb_coding.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 556b4605af2d5bd610bcd4a9c315ac7a33dc8084..f616fb9a6899bc5bf9edd354f6d8fa3a2fde1dfc 100644
--- a/content/browser/indexed_db/indexed_db_leveldb_coding.h
+++ b/content/browser/indexed_db/indexed_db_leveldb_coding.h
@@ -92,13 +92,16 @@ class KeyPrefix {
static std::string EncodeEmpty();
int Compare(const KeyPrefix& other) const;
+ // These are serialized to disk; any new items must be appended, and none can
+ // be deleted.
enum Type {
GLOBAL_METADATA,
DATABASE_METADATA,
OBJECT_STORE_DATA,
EXISTS_ENTRY,
INDEX_DATA,
- INVALID_TYPE
+ INVALID_TYPE,
+ BLOB_ENTRY
};
static const size_t kMaxDatabaseIdSizeBits = 3;
@@ -172,6 +175,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();
@@ -212,9 +225,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);
};
@@ -384,6 +403,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 EncodeMinKeyForObjectStore(int64 database_id,
+ int64 object_store_id);
+ static std::string EncodeStopKeyForObjectStore(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_; }
+
+ 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_;
+ DISALLOW_COPY_AND_ASSIGN(BlobEntryKey);
+};
+
class IndexDataKey {
public:
IndexDataKey();
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_leveldb_coding.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698