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

Side by Side Diff: content/browser/indexed_db/indexed_db_backing_store.h

Issue 810403004: [Storage] Blob Storage Refactoring pt 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: memory leak fixed Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 BlobChangeRecord(const std::string& key, int64 object_store_id); 98 BlobChangeRecord(const std::string& key, int64 object_store_id);
99 ~BlobChangeRecord(); 99 ~BlobChangeRecord();
100 100
101 const std::string& key() const { return key_; } 101 const std::string& key() const { return key_; }
102 int64 object_store_id() const { return object_store_id_; } 102 int64 object_store_id() const { return object_store_id_; }
103 void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info); 103 void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info);
104 std::vector<IndexedDBBlobInfo>& mutable_blob_info() { return blob_info_; } 104 std::vector<IndexedDBBlobInfo>& mutable_blob_info() { return blob_info_; }
105 const std::vector<IndexedDBBlobInfo>& blob_info() const { 105 const std::vector<IndexedDBBlobInfo>& blob_info() const {
106 return blob_info_; 106 return blob_info_;
107 } 107 }
108 void SetHandles(ScopedVector<storage::BlobDataHandle>* handles); 108 void SetHandles(ScopedVector<storage::BlobDataSnapshotHandle>* handles);
109 scoped_ptr<BlobChangeRecord> Clone() const; 109 scoped_ptr<BlobChangeRecord> Clone() const;
110 110
111 private: 111 private:
112 std::string key_; 112 std::string key_;
113 int64 object_store_id_; 113 int64 object_store_id_;
114 std::vector<IndexedDBBlobInfo> blob_info_; 114 std::vector<IndexedDBBlobInfo> blob_info_;
115 ScopedVector<storage::BlobDataHandle> handles_; 115 ScopedVector<storage::BlobDataSnapshotHandle> handles_;
116 DISALLOW_COPY_AND_ASSIGN(BlobChangeRecord); 116 DISALLOW_COPY_AND_ASSIGN(BlobChangeRecord);
117 }; 117 };
118 typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap; 118 typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap;
119 119
120 class CONTENT_EXPORT Transaction { 120 class CONTENT_EXPORT Transaction {
121 public: 121 public:
122 explicit Transaction(IndexedDBBackingStore* backing_store); 122 explicit Transaction(IndexedDBBackingStore* backing_store);
123 virtual ~Transaction(); 123 virtual ~Transaction();
124 124
125 virtual void Begin(); 125 virtual void Begin();
126 // The callback will be called eventually on success or failure, or 126 // The callback will be called eventually on success or failure, or
127 // immediately if phase one is complete due to lack of any blobs to write. 127 // immediately if phase one is complete due to lack of any blobs to write.
128 virtual leveldb::Status CommitPhaseOne(scoped_refptr<BlobWriteCallback>); 128 virtual leveldb::Status CommitPhaseOne(scoped_refptr<BlobWriteCallback>);
129 virtual leveldb::Status CommitPhaseTwo(); 129 virtual leveldb::Status CommitPhaseTwo();
130 virtual void Rollback(); 130 virtual void Rollback();
131 void Reset() { 131 void Reset() {
132 backing_store_ = NULL; 132 backing_store_ = NULL;
133 transaction_ = NULL; 133 transaction_ = NULL;
134 } 134 }
135 leveldb::Status PutBlobInfoIfNeeded( 135 leveldb::Status PutBlobInfoIfNeeded(
136 int64 database_id, 136 int64 database_id,
137 int64 object_store_id, 137 int64 object_store_id,
138 const std::string& object_store_data_key, 138 const std::string& object_store_data_key,
139 std::vector<IndexedDBBlobInfo>*, 139 std::vector<IndexedDBBlobInfo>*,
140 ScopedVector<storage::BlobDataHandle>* handles); 140 ScopedVector<storage::BlobDataSnapshotHandle>* handles);
141 void PutBlobInfo(int64 database_id, 141 void PutBlobInfo(int64 database_id,
142 int64 object_store_id, 142 int64 object_store_id,
143 const std::string& object_store_data_key, 143 const std::string& object_store_data_key,
144 std::vector<IndexedDBBlobInfo>*, 144 std::vector<IndexedDBBlobInfo>*,
145 ScopedVector<storage::BlobDataHandle>* handles); 145 ScopedVector<storage::BlobDataSnapshotHandle>* handles);
146 146
147 LevelDBTransaction* transaction() { return transaction_.get(); } 147 LevelDBTransaction* transaction() { return transaction_.get(); }
148 148
149 leveldb::Status GetBlobInfoForRecord( 149 leveldb::Status GetBlobInfoForRecord(
150 int64 database_id, 150 int64 database_id,
151 const std::string& object_store_data_key, 151 const std::string& object_store_data_key,
152 IndexedDBValue* value); 152 IndexedDBValue* value);
153 153
154 // This holds a BlobEntryKey and the encoded IndexedDBBlobInfo vector stored 154 // This holds a BlobEntryKey and the encoded IndexedDBBlobInfo vector stored
155 // under that key. 155 // under that key.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 int64 database_id, 388 int64 database_id,
389 int64 object_store_id, 389 int64 object_store_id,
390 const IndexedDBKey& key, 390 const IndexedDBKey& key,
391 IndexedDBValue* record) WARN_UNUSED_RESULT; 391 IndexedDBValue* record) WARN_UNUSED_RESULT;
392 virtual leveldb::Status PutRecord( 392 virtual leveldb::Status PutRecord(
393 IndexedDBBackingStore::Transaction* transaction, 393 IndexedDBBackingStore::Transaction* transaction,
394 int64 database_id, 394 int64 database_id,
395 int64 object_store_id, 395 int64 object_store_id,
396 const IndexedDBKey& key, 396 const IndexedDBKey& key,
397 IndexedDBValue* value, 397 IndexedDBValue* value,
398 ScopedVector<storage::BlobDataHandle>* handles, 398 ScopedVector<storage::BlobDataSnapshotHandle>* handles,
399 RecordIdentifier* record) WARN_UNUSED_RESULT; 399 RecordIdentifier* record) WARN_UNUSED_RESULT;
400 virtual leveldb::Status ClearObjectStore( 400 virtual leveldb::Status ClearObjectStore(
401 IndexedDBBackingStore::Transaction* transaction, 401 IndexedDBBackingStore::Transaction* transaction,
402 int64 database_id, 402 int64 database_id,
403 int64 object_store_id) WARN_UNUSED_RESULT; 403 int64 object_store_id) WARN_UNUSED_RESULT;
404 virtual leveldb::Status DeleteRecord( 404 virtual leveldb::Status DeleteRecord(
405 IndexedDBBackingStore::Transaction* transaction, 405 IndexedDBBackingStore::Transaction* transaction,
406 int64 database_id, 406 int64 database_id,
407 int64 object_store_id, 407 int64 object_store_id,
408 const RecordIdentifier& record) WARN_UNUSED_RESULT; 408 const RecordIdentifier& record) WARN_UNUSED_RESULT;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // will hold a reference to this backing store. 581 // will hold a reference to this backing store.
582 IndexedDBActiveBlobRegistry active_blob_registry_; 582 IndexedDBActiveBlobRegistry active_blob_registry_;
583 base::OneShotTimer<IndexedDBBackingStore> close_timer_; 583 base::OneShotTimer<IndexedDBBackingStore> close_timer_;
584 584
585 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); 585 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore);
586 }; 586 };
587 587
588 } // namespace content 588 } // namespace content
589 589
590 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 590 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698