| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 IndexedDBBackingStore* backing_store_; | 343 IndexedDBBackingStore* backing_store_; |
| 344 Transaction* transaction_; | 344 Transaction* transaction_; |
| 345 int64_t database_id_; | 345 int64_t database_id_; |
| 346 const CursorOptions cursor_options_; | 346 const CursorOptions cursor_options_; |
| 347 std::unique_ptr<LevelDBIterator> iterator_; | 347 std::unique_ptr<LevelDBIterator> iterator_; |
| 348 std::unique_ptr<IndexedDBKey> current_key_; | 348 std::unique_ptr<IndexedDBKey> current_key_; |
| 349 IndexedDBBackingStore::RecordIdentifier record_identifier_; | 349 IndexedDBBackingStore::RecordIdentifier record_identifier_; |
| 350 | 350 |
| 351 private: | 351 private: |
| 352 enum class ContinueResult { LEVELDB_ERROR, DONE, OUT_OF_BOUNDS }; |
| 353 |
| 352 // For cursors with direction Next or NextNoDuplicate. | 354 // For cursors with direction Next or NextNoDuplicate. |
| 353 bool ContinueNext(const IndexedDBKey* key, | 355 ContinueResult ContinueNext(const IndexedDBKey* key, |
| 354 const IndexedDBKey* primary_key, | 356 const IndexedDBKey* primary_key, |
| 355 IteratorState state, | 357 IteratorState state, |
| 356 leveldb::Status*); | 358 leveldb::Status*); |
| 357 // For cursors with direction Prev or PrevNoDuplicate. The PrevNoDuplicate | 359 // For cursors with direction Prev or PrevNoDuplicate. The PrevNoDuplicate |
| 358 // case has additional complexity of not being symmetric with | 360 // case has additional complexity of not being symmetric with |
| 359 // NextNoDuplicate. | 361 // NextNoDuplicate. |
| 360 bool ContinuePrevious(const IndexedDBKey* key, | 362 ContinueResult ContinuePrevious(const IndexedDBKey* key, |
| 361 const IndexedDBKey* primary_key, | 363 const IndexedDBKey* primary_key, |
| 362 IteratorState state, | 364 IteratorState state, |
| 363 leveldb::Status*); | 365 leveldb::Status*); |
| 364 | 366 |
| 365 DISALLOW_COPY_AND_ASSIGN(Cursor); | 367 DISALLOW_COPY_AND_ASSIGN(Cursor); |
| 366 }; | 368 }; |
| 367 | 369 |
| 368 const url::Origin& origin() const { return origin_; } | 370 const url::Origin& origin() const { return origin_; } |
| 369 IndexedDBFactory* factory() const { return indexed_db_factory_; } | 371 IndexedDBFactory* factory() const { return indexed_db_factory_; } |
| 370 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } | 372 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } |
| 371 base::OneShotTimer* close_timer() { return &close_timer_; } | 373 base::OneShotTimer* close_timer() { return &close_timer_; } |
| 372 IndexedDBActiveBlobRegistry* active_blob_registry() { | 374 IndexedDBActiveBlobRegistry* active_blob_registry() { |
| 373 return &active_blob_registry_; | 375 return &active_blob_registry_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // Compact is public for testing. | 411 // Compact is public for testing. |
| 410 virtual void Compact(); | 412 virtual void Compact(); |
| 411 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*); | 413 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*); |
| 412 virtual leveldb::Status GetIDBDatabaseMetaData( | 414 virtual leveldb::Status GetIDBDatabaseMetaData( |
| 413 const base::string16& name, | 415 const base::string16& name, |
| 414 IndexedDBDatabaseMetadata* metadata, | 416 IndexedDBDatabaseMetadata* metadata, |
| 415 bool* success) WARN_UNUSED_RESULT; | 417 bool* success) WARN_UNUSED_RESULT; |
| 416 virtual leveldb::Status CreateIDBDatabaseMetaData(const base::string16& name, | 418 virtual leveldb::Status CreateIDBDatabaseMetaData(const base::string16& name, |
| 417 int64_t version, | 419 int64_t version, |
| 418 int64_t* row_id); | 420 int64_t* row_id); |
| 419 virtual bool UpdateIDBDatabaseIntVersion( | 421 virtual void UpdateIDBDatabaseIntVersion( |
| 420 IndexedDBBackingStore::Transaction* transaction, | 422 IndexedDBBackingStore::Transaction* transaction, |
| 421 int64_t row_id, | 423 int64_t row_id, |
| 422 int64_t version); | 424 int64_t version); |
| 423 virtual leveldb::Status DeleteDatabase(const base::string16& name); | 425 virtual leveldb::Status DeleteDatabase(const base::string16& name); |
| 424 | 426 |
| 425 // Assumes caller has already closed the backing store. | 427 // Assumes caller has already closed the backing store. |
| 426 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base, | 428 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base, |
| 427 const url::Origin& origin); | 429 const url::Origin& origin); |
| 428 static bool RecordCorruptionInfo(const base::FilePath& path_base, | 430 static bool RecordCorruptionInfo(const base::FilePath& path_base, |
| 429 const url::Origin& origin, | 431 const url::Origin& origin, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // complete. While > 0, temporary journal entries may exist so out-of-band | 687 // complete. While > 0, temporary journal entries may exist so out-of-band |
| 686 // journal cleaning must be deferred. | 688 // journal cleaning must be deferred. |
| 687 size_t committing_transaction_count_; | 689 size_t committing_transaction_count_; |
| 688 | 690 |
| 689 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); | 691 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
| 690 }; | 692 }; |
| 691 | 693 |
| 692 } // namespace content | 694 } // namespace content |
| 693 | 695 |
| 694 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 696 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |