OLD | NEW |
---|---|
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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "content/common/indexed_db/indexed_db_key.h" | 21 #include "content/common/indexed_db/indexed_db_key.h" |
22 #include "content/common/indexed_db/indexed_db_key_path.h" | 22 #include "content/common/indexed_db/indexed_db_key_path.h" |
23 #include "content/common/indexed_db/indexed_db_key_range.h" | 23 #include "content/common/indexed_db/indexed_db_key_range.h" |
24 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 24 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 class LevelDBComparator; | 29 class LevelDBComparator; |
30 class LevelDBDatabase; | 30 class LevelDBDatabase; |
31 struct IndexedDBValue; | |
31 | 32 |
32 class LevelDBFactory { | 33 class LevelDBFactory { |
33 public: | 34 public: |
34 virtual ~LevelDBFactory() {} | 35 virtual ~LevelDBFactory() {} |
35 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name, | 36 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name, |
36 const LevelDBComparator* comparator, | 37 const LevelDBComparator* comparator, |
37 scoped_ptr<LevelDBDatabase>* db, | 38 scoped_ptr<LevelDBDatabase>* db, |
38 bool* is_disk_full) = 0; | 39 bool* is_disk_full) = 0; |
39 virtual leveldb::Status DestroyLevelDB(const base::FilePath& file_name) = 0; | 40 virtual leveldb::Status DestroyLevelDB(const base::FilePath& file_name) = 0; |
40 }; | 41 }; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 std::string primary_key_; | 120 std::string primary_key_; |
120 int64 version_; | 121 int64 version_; |
121 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); | 122 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); |
122 }; | 123 }; |
123 | 124 |
124 virtual leveldb::Status GetRecord( | 125 virtual leveldb::Status GetRecord( |
125 IndexedDBBackingStore::Transaction* transaction, | 126 IndexedDBBackingStore::Transaction* transaction, |
126 int64 database_id, | 127 int64 database_id, |
127 int64 object_store_id, | 128 int64 object_store_id, |
128 const IndexedDBKey& key, | 129 const IndexedDBKey& key, |
129 std::string* record) WARN_UNUSED_RESULT; | 130 IndexedDBValue* record) WARN_UNUSED_RESULT; |
130 virtual leveldb::Status PutRecord( | 131 virtual leveldb::Status PutRecord( |
131 IndexedDBBackingStore::Transaction* transaction, | 132 IndexedDBBackingStore::Transaction* transaction, |
132 int64 database_id, | 133 int64 database_id, |
133 int64 object_store_id, | 134 int64 object_store_id, |
134 const IndexedDBKey& key, | 135 const IndexedDBKey& key, |
135 const std::string& value, | 136 IndexedDBValue& value, |
cmumford
2014/03/14 00:36:16
Did you intend to un-constify this param?
ericu
2014/03/14 01:17:23
It's mutable in the big CL so that the blob info c
| |
136 RecordIdentifier* record) WARN_UNUSED_RESULT; | 137 RecordIdentifier* record) WARN_UNUSED_RESULT; |
137 virtual leveldb::Status ClearObjectStore( | 138 virtual leveldb::Status ClearObjectStore( |
138 IndexedDBBackingStore::Transaction* transaction, | 139 IndexedDBBackingStore::Transaction* transaction, |
139 int64 database_id, | 140 int64 database_id, |
140 int64 object_store_id) WARN_UNUSED_RESULT; | 141 int64 object_store_id) WARN_UNUSED_RESULT; |
141 virtual leveldb::Status DeleteRecord( | 142 virtual leveldb::Status DeleteRecord( |
142 IndexedDBBackingStore::Transaction* transaction, | 143 IndexedDBBackingStore::Transaction* transaction, |
143 int64 database_id, | 144 int64 database_id, |
144 int64 object_store_id, | 145 int64 object_store_id, |
145 const RecordIdentifier& record) WARN_UNUSED_RESULT; | 146 const RecordIdentifier& record) WARN_UNUSED_RESULT; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 return Continue(key, NULL, state); | 229 return Continue(key, NULL, state); |
229 } | 230 } |
230 bool Continue(const IndexedDBKey* key, | 231 bool Continue(const IndexedDBKey* key, |
231 const IndexedDBKey* primary_key, | 232 const IndexedDBKey* primary_key, |
232 IteratorState state); | 233 IteratorState state); |
233 bool Advance(uint32 count); | 234 bool Advance(uint32 count); |
234 bool FirstSeek(); | 235 bool FirstSeek(); |
235 | 236 |
236 virtual Cursor* Clone() = 0; | 237 virtual Cursor* Clone() = 0; |
237 virtual const IndexedDBKey& primary_key() const; | 238 virtual const IndexedDBKey& primary_key() const; |
238 virtual std::string* value() = 0; | 239 virtual IndexedDBValue* value() = 0; |
239 virtual const RecordIdentifier& record_identifier() const; | 240 virtual const RecordIdentifier& record_identifier() const; |
240 virtual bool LoadCurrentRow() = 0; | 241 virtual bool LoadCurrentRow() = 0; |
241 | 242 |
242 protected: | 243 protected: |
243 Cursor(LevelDBTransaction* transaction, | 244 Cursor(LevelDBTransaction* transaction, |
244 const CursorOptions& cursor_options); | 245 const CursorOptions& cursor_options); |
245 explicit Cursor(const IndexedDBBackingStore::Cursor* other); | 246 explicit Cursor(const IndexedDBBackingStore::Cursor* other); |
246 | 247 |
247 virtual std::string EncodeKey(const IndexedDBKey& key) = 0; | 248 virtual std::string EncodeKey(const IndexedDBKey& key) = 0; |
248 virtual std::string EncodeKey(const IndexedDBKey& key, | 249 virtual std::string EncodeKey(const IndexedDBKey& key, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 const std::string origin_identifier_; | 342 const std::string origin_identifier_; |
342 | 343 |
343 scoped_ptr<LevelDBDatabase> db_; | 344 scoped_ptr<LevelDBDatabase> db_; |
344 scoped_ptr<LevelDBComparator> comparator_; | 345 scoped_ptr<LevelDBComparator> comparator_; |
345 base::OneShotTimer<IndexedDBBackingStore> close_timer_; | 346 base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
346 }; | 347 }; |
347 | 348 |
348 } // namespace content | 349 } // namespace content |
349 | 350 |
350 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 351 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
OLD | NEW |