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..02d8794d4579274069205ca7d0564ee51eca59e2 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, |
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,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 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(); |