Index: content/browser/indexed_db/indexed_db_backing_store.h |
diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h |
index d56619e68ee96cdc3283e390dccebe9eb4b15599..95656a93c939770e2cef0aceab3d40be6b5301a7 100644 |
--- a/content/browser/indexed_db/indexed_db_backing_store.h |
+++ b/content/browser/indexed_db/indexed_db_backing_store.h |
@@ -203,6 +203,11 @@ class CONTENT_EXPORT IndexedDBBackingStore |
int64 database_id, |
int64 object_store_id, |
const RecordIdentifier& record) WARN_UNUSED_RESULT; |
+ virtual leveldb::Status DeleteRange( |
+ IndexedDBBackingStore::Transaction* transaction, |
+ int64 database_id, |
+ int64 object_store_id, |
+ const IndexedDBKeyRange&) WARN_UNUSED_RESULT; |
virtual leveldb::Status GetKeyGeneratorCurrentNumber( |
IndexedDBBackingStore::Transaction* transaction, |
int64 database_id, |
@@ -264,6 +269,8 @@ class CONTENT_EXPORT IndexedDBBackingStore |
base::FilePath GetBlobFileName(int64 database_id, int64 key); |
+ class Transaction; |
+ |
class Cursor { |
public: |
virtual ~Cursor(); |
@@ -308,7 +315,9 @@ class CONTENT_EXPORT IndexedDBBackingStore |
virtual bool LoadCurrentRow() = 0; |
protected: |
- Cursor(LevelDBTransaction* transaction, |
+ Cursor(scoped_refptr<IndexedDBBackingStore> backing_store, |
+ Transaction* transaction, |
+ int64 database_id, |
const CursorOptions& cursor_options); |
explicit Cursor(const IndexedDBBackingStore::Cursor* other); |
@@ -319,7 +328,9 @@ class CONTENT_EXPORT IndexedDBBackingStore |
bool IsPastBounds() const; |
bool HaveEnteredRange() const; |
- LevelDBTransaction* transaction_; |
+ IndexedDBBackingStore* backing_store_; |
+ Transaction* transaction_; |
+ int64 database_id_; |
const CursorOptions cursor_options_; |
scoped_ptr<LevelDBIterator> iterator_; |
scoped_ptr<IndexedDBKey> current_key_; |
@@ -385,7 +396,10 @@ class CONTENT_EXPORT IndexedDBBackingStore |
explicit Transaction(IndexedDBBackingStore* backing_store); |
virtual ~Transaction(); |
virtual void Begin(); |
- virtual leveldb::Status Commit(); |
+ // The callback will be called eventually on success or failure, or |
+ // immediately if phase one is complete due to lack of any blobs to write. |
+ virtual leveldb::Status CommitPhaseOne(scoped_refptr<BlobWriteCallback>); |
+ virtual leveldb::Status CommitPhaseTwo(); |
virtual void Rollback(); |
void Reset() { |
backing_store_ = NULL; |
@@ -399,6 +413,11 @@ class CONTENT_EXPORT IndexedDBBackingStore |
LevelDBTransaction* transaction() { return transaction_; } |
+ leveldb::Status GetBlobInfoForRecord( |
+ int64 database_id, |
+ const std::string& object_store_data_key, |
+ IndexedDBValue* value); |
+ |
// This holds a BlobEntryKey and the encoded IndexedDBBlobInfo vector stored |
// under that key. |
typedef std::vector<std::pair<BlobEntryKey, std::string> > |
@@ -449,16 +468,23 @@ class CONTENT_EXPORT IndexedDBBackingStore |
private: |
class BlobWriteCallbackWrapper; |
+ // These return true on success, false on failure. |
+ leveldb::Status HandleBlobPreTransaction( |
+ BlobEntryKeyValuePairVec* new_blob_entries, |
+ WriteDescriptorVec* new_files_to_write); |
+ bool CollectBlobFilesToRemove(); |
// The callback will be called eventually on success or failure. |
void WriteNewBlobs(BlobEntryKeyValuePairVec& new_blob_entries, |
WriteDescriptorVec& new_files_to_write, |
scoped_refptr<BlobWriteCallback> callback); |
+ leveldb::Status SortBlobsToRemove(); |
IndexedDBBackingStore* backing_store_; |
scoped_refptr<LevelDBTransaction> transaction_; |
BlobChangeMap blob_change_map_; |
BlobChangeMap incognito_blob_map_; |
int64 database_id_; |
+ BlobJournalType blobs_to_remove_; |
scoped_refptr<ChainedBlobWriter> chained_blob_writer_; |
}; |
@@ -475,6 +501,8 @@ class CONTENT_EXPORT IndexedDBBackingStore |
bool is_incognito() const { return !indexed_db_factory_; } |
+ bool SetUpMetadata(); |
+ |
virtual bool WriteBlobFile( |
int64 database_id, |
const Transaction::WriteDescriptor& descriptor, |