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

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: Merge fixes [builds, untested] Created 7 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
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 974c27a4fa2bc7b06010a5cbad44d67f915cf79b..ec18e18582bf064187477da18f261371e33542ad 100644
--- a/content/browser/indexed_db/indexed_db_leveldb_coding.h
+++ b/content/browser/indexed_db/indexed_db_leveldb_coding.h
@@ -93,6 +93,7 @@ class KeyPrefix {
DATABASE_METADATA,
OBJECT_STORE_DATA,
EXISTS_ENTRY,
+ BLOB_ENTRY,
INDEX_DATA,
INVALID_TYPE
};
@@ -168,6 +169,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();
@@ -207,9 +218,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);
};
@@ -380,6 +397,41 @@ 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 EncodeToObjectStoreDataKey(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