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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( | 90 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
91 const GURL& origin_url, | 91 const GURL& origin_url, |
92 base::TaskRunner* task_runner); | 92 base::TaskRunner* task_runner); |
93 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( | 93 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
94 const GURL& origin_url, | 94 const GURL& origin_url, |
95 LevelDBFactory* level_db_factory, | 95 LevelDBFactory* level_db_factory, |
96 base::TaskRunner* task_runner); | 96 base::TaskRunner* task_runner); |
97 | 97 |
98 // Compact is public for testing. | 98 // Compact is public for testing. |
99 virtual void Compact(); | 99 virtual void Compact(); |
100 virtual std::vector<base::string16> GetDatabaseNames(); | 100 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*); |
101 virtual leveldb::Status GetIDBDatabaseMetaData( | 101 virtual leveldb::Status GetIDBDatabaseMetaData( |
102 const base::string16& name, | 102 const base::string16& name, |
103 IndexedDBDatabaseMetadata* metadata, | 103 IndexedDBDatabaseMetadata* metadata, |
104 bool* success) WARN_UNUSED_RESULT; | 104 bool* success) WARN_UNUSED_RESULT; |
105 virtual leveldb::Status CreateIDBDatabaseMetaData( | 105 virtual leveldb::Status CreateIDBDatabaseMetaData( |
106 const base::string16& name, | 106 const base::string16& name, |
107 const base::string16& version, | 107 const base::string16& version, |
108 int64 int_version, | 108 int64 int_version, |
109 int64* row_id); | 109 int64* row_id); |
110 virtual bool UpdateIDBDatabaseIntVersion( | 110 virtual bool UpdateIDBDatabaseIntVersion( |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 int64 index_id; | 253 int64 index_id; |
254 std::string low_key; | 254 std::string low_key; |
255 bool low_open; | 255 bool low_open; |
256 std::string high_key; | 256 std::string high_key; |
257 bool high_open; | 257 bool high_open; |
258 bool forward; | 258 bool forward; |
259 bool unique; | 259 bool unique; |
260 }; | 260 }; |
261 | 261 |
262 const IndexedDBKey& key() const { return *current_key_; } | 262 const IndexedDBKey& key() const { return *current_key_; } |
263 bool Continue() { return Continue(NULL, NULL, SEEK); } | 263 bool Continue(leveldb::Status* s) { return Continue(NULL, NULL, SEEK, s); } |
264 bool Continue(const IndexedDBKey* key, IteratorState state) { | 264 bool Continue(const IndexedDBKey* key, |
265 return Continue(key, NULL, state); | 265 IteratorState state, |
| 266 leveldb::Status* s) { |
| 267 return Continue(key, NULL, state, s); |
266 } | 268 } |
267 bool Continue(const IndexedDBKey* key, | 269 bool Continue(const IndexedDBKey* key, |
268 const IndexedDBKey* primary_key, | 270 const IndexedDBKey* primary_key, |
269 IteratorState state); | 271 IteratorState state, |
270 bool Advance(uint32 count); | 272 leveldb::Status*); |
271 bool FirstSeek(); | 273 bool Advance(uint32 count, leveldb::Status*); |
| 274 bool FirstSeek(leveldb::Status*); |
272 | 275 |
273 virtual Cursor* Clone() = 0; | 276 virtual Cursor* Clone() = 0; |
274 virtual const IndexedDBKey& primary_key() const; | 277 virtual const IndexedDBKey& primary_key() const; |
275 virtual IndexedDBValue* value() = 0; | 278 virtual IndexedDBValue* value() = 0; |
276 virtual const RecordIdentifier& record_identifier() const; | 279 virtual const RecordIdentifier& record_identifier() const; |
277 virtual bool LoadCurrentRow() = 0; | 280 virtual bool LoadCurrentRow() = 0; |
278 | 281 |
279 protected: | 282 protected: |
280 Cursor(LevelDBTransaction* transaction, | 283 Cursor(LevelDBTransaction* transaction, |
281 const CursorOptions& cursor_options); | 284 const CursorOptions& cursor_options); |
(...skipping 11 matching lines...) Expand all Loading... |
293 scoped_ptr<LevelDBIterator> iterator_; | 296 scoped_ptr<LevelDBIterator> iterator_; |
294 scoped_ptr<IndexedDBKey> current_key_; | 297 scoped_ptr<IndexedDBKey> current_key_; |
295 IndexedDBBackingStore::RecordIdentifier record_identifier_; | 298 IndexedDBBackingStore::RecordIdentifier record_identifier_; |
296 }; | 299 }; |
297 | 300 |
298 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( | 301 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( |
299 IndexedDBBackingStore::Transaction* transaction, | 302 IndexedDBBackingStore::Transaction* transaction, |
300 int64 database_id, | 303 int64 database_id, |
301 int64 object_store_id, | 304 int64 object_store_id, |
302 const IndexedDBKeyRange& key_range, | 305 const IndexedDBKeyRange& key_range, |
303 indexed_db::CursorDirection); | 306 indexed_db::CursorDirection, |
| 307 leveldb::Status*); |
304 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( | 308 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( |
305 IndexedDBBackingStore::Transaction* transaction, | 309 IndexedDBBackingStore::Transaction* transaction, |
306 int64 database_id, | 310 int64 database_id, |
307 int64 object_store_id, | 311 int64 object_store_id, |
308 const IndexedDBKeyRange& key_range, | 312 const IndexedDBKeyRange& key_range, |
309 indexed_db::CursorDirection); | 313 indexed_db::CursorDirection, |
| 314 leveldb::Status*); |
310 virtual scoped_ptr<Cursor> OpenIndexKeyCursor( | 315 virtual scoped_ptr<Cursor> OpenIndexKeyCursor( |
311 IndexedDBBackingStore::Transaction* transaction, | 316 IndexedDBBackingStore::Transaction* transaction, |
312 int64 database_id, | 317 int64 database_id, |
313 int64 object_store_id, | 318 int64 object_store_id, |
314 int64 index_id, | 319 int64 index_id, |
315 const IndexedDBKeyRange& key_range, | 320 const IndexedDBKeyRange& key_range, |
316 indexed_db::CursorDirection); | 321 indexed_db::CursorDirection, |
| 322 leveldb::Status*); |
317 virtual scoped_ptr<Cursor> OpenIndexCursor( | 323 virtual scoped_ptr<Cursor> OpenIndexCursor( |
318 IndexedDBBackingStore::Transaction* transaction, | 324 IndexedDBBackingStore::Transaction* transaction, |
319 int64 database_id, | 325 int64 database_id, |
320 int64 object_store_id, | 326 int64 object_store_id, |
321 int64 index_id, | 327 int64 index_id, |
322 const IndexedDBKeyRange& key_range, | 328 const IndexedDBKeyRange& key_range, |
323 indexed_db::CursorDirection); | 329 indexed_db::CursorDirection, |
| 330 leveldb::Status*); |
324 | 331 |
325 class Transaction { | 332 class Transaction { |
326 public: | 333 public: |
327 explicit Transaction(IndexedDBBackingStore* backing_store); | 334 explicit Transaction(IndexedDBBackingStore* backing_store); |
328 virtual ~Transaction(); | 335 virtual ~Transaction(); |
329 virtual void Begin(); | 336 virtual void Begin(); |
330 virtual leveldb::Status Commit(); | 337 virtual leveldb::Status Commit(); |
331 virtual void Rollback(); | 338 virtual void Rollback(); |
332 void Reset() { | 339 void Reset() { |
333 backing_store_ = NULL; | 340 backing_store_ = NULL; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 scoped_ptr<LevelDBComparator> comparator_; | 398 scoped_ptr<LevelDBComparator> comparator_; |
392 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ | 399 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ |
393 // will hold a reference to this backing store. | 400 // will hold a reference to this backing store. |
394 IndexedDBActiveBlobRegistry active_blob_registry_; | 401 IndexedDBActiveBlobRegistry active_blob_registry_; |
395 base::OneShotTimer<IndexedDBBackingStore> close_timer_; | 402 base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
396 }; | 403 }; |
397 | 404 |
398 } // namespace content | 405 } // namespace content |
399 | 406 |
400 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 407 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
OLD | NEW |