Chromium Code Reviews| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 bool Continue(const IndexedDBKey* key, | 311 bool Continue(const IndexedDBKey* key, |
| 312 IteratorState state, | 312 IteratorState state, |
| 313 leveldb::Status* s) { | 313 leveldb::Status* s) { |
| 314 return Continue(key, NULL, state, s); | 314 return Continue(key, NULL, state, s); |
| 315 } | 315 } |
| 316 bool Continue(const IndexedDBKey* key, | 316 bool Continue(const IndexedDBKey* key, |
| 317 const IndexedDBKey* primary_key, | 317 const IndexedDBKey* primary_key, |
| 318 IteratorState state, | 318 IteratorState state, |
| 319 leveldb::Status*); | 319 leveldb::Status*); |
| 320 bool Advance(uint32_t count, leveldb::Status*); | 320 bool Advance(uint32_t count, leveldb::Status*); |
| 321 // Returns true when no error and we haven't reached the end of the data. | |
| 321 bool FirstSeek(leveldb::Status*); | 322 bool FirstSeek(leveldb::Status*); |
| 322 | 323 |
| 323 virtual std::unique_ptr<Cursor> Clone() const = 0; | 324 virtual std::unique_ptr<Cursor> Clone() const = 0; |
| 324 virtual const IndexedDBKey& primary_key() const; | 325 virtual const IndexedDBKey& primary_key() const; |
| 325 virtual IndexedDBValue* value() = 0; | 326 virtual IndexedDBValue* value() = 0; |
| 326 virtual const RecordIdentifier& record_identifier() const; | 327 virtual const RecordIdentifier& record_identifier() const; |
| 327 virtual bool LoadCurrentRow(leveldb::Status* s) = 0; | 328 virtual bool LoadCurrentRow(leveldb::Status* s) = 0; |
| 328 | 329 |
| 329 protected: | 330 protected: |
| 330 Cursor(scoped_refptr<IndexedDBBackingStore> backing_store, | 331 Cursor(scoped_refptr<IndexedDBBackingStore> backing_store, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 343 IndexedDBBackingStore* backing_store_; | 344 IndexedDBBackingStore* backing_store_; |
| 344 Transaction* transaction_; | 345 Transaction* transaction_; |
| 345 int64_t database_id_; | 346 int64_t database_id_; |
| 346 const CursorOptions cursor_options_; | 347 const CursorOptions cursor_options_; |
| 347 std::unique_ptr<LevelDBIterator> iterator_; | 348 std::unique_ptr<LevelDBIterator> iterator_; |
| 348 std::unique_ptr<IndexedDBKey> current_key_; | 349 std::unique_ptr<IndexedDBKey> current_key_; |
| 349 IndexedDBBackingStore::RecordIdentifier record_identifier_; | 350 IndexedDBBackingStore::RecordIdentifier record_identifier_; |
| 350 | 351 |
| 351 private: | 352 private: |
| 352 // For cursors with direction Next or NextNoDuplicate. | 353 // For cursors with direction Next or NextNoDuplicate. |
| 354 // Returns true when no error and we haven't reached the end of the data. | |
|
cmumford
2016/11/21 18:29:22
Do you think it would be clearer if this instead r
dmurph
2016/11/22 23:33:10
mmmm this is a large change, as I'll want to chang
cmumford
2016/11/28 20:48:25
Acknowledged.
| |
| 353 bool ContinueNext(const IndexedDBKey* key, | 355 bool 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. |
| 362 // Returns true when no error and we haven't reached the end of the data. | |
| 360 bool ContinuePrevious(const IndexedDBKey* key, | 363 bool ContinuePrevious(const IndexedDBKey* key, |
| 361 const IndexedDBKey* primary_key, | 364 const IndexedDBKey* primary_key, |
| 362 IteratorState state, | 365 IteratorState state, |
| 363 leveldb::Status*); | 366 leveldb::Status*); |
| 364 | 367 |
| 365 DISALLOW_COPY_AND_ASSIGN(Cursor); | 368 DISALLOW_COPY_AND_ASSIGN(Cursor); |
| 366 }; | 369 }; |
| 367 | 370 |
| 368 const url::Origin& origin() const { return origin_; } | 371 const url::Origin& origin() const { return origin_; } |
| 369 IndexedDBFactory* factory() const { return indexed_db_factory_; } | 372 IndexedDBFactory* factory() const { return indexed_db_factory_; } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 // Compact is public for testing. | 412 // Compact is public for testing. |
| 410 virtual void Compact(); | 413 virtual void Compact(); |
| 411 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*); | 414 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*); |
| 412 virtual leveldb::Status GetIDBDatabaseMetaData( | 415 virtual leveldb::Status GetIDBDatabaseMetaData( |
| 413 const base::string16& name, | 416 const base::string16& name, |
| 414 IndexedDBDatabaseMetadata* metadata, | 417 IndexedDBDatabaseMetadata* metadata, |
| 415 bool* success) WARN_UNUSED_RESULT; | 418 bool* success) WARN_UNUSED_RESULT; |
| 416 virtual leveldb::Status CreateIDBDatabaseMetaData(const base::string16& name, | 419 virtual leveldb::Status CreateIDBDatabaseMetaData(const base::string16& name, |
| 417 int64_t version, | 420 int64_t version, |
| 418 int64_t* row_id); | 421 int64_t* row_id); |
| 419 virtual bool UpdateIDBDatabaseIntVersion( | 422 virtual void UpdateIDBDatabaseIntVersion( |
| 420 IndexedDBBackingStore::Transaction* transaction, | 423 IndexedDBBackingStore::Transaction* transaction, |
| 421 int64_t row_id, | 424 int64_t row_id, |
| 422 int64_t version); | 425 int64_t version); |
| 423 virtual leveldb::Status DeleteDatabase(const base::string16& name); | 426 virtual leveldb::Status DeleteDatabase(const base::string16& name); |
| 424 | 427 |
| 425 // Assumes caller has already closed the backing store. | 428 // Assumes caller has already closed the backing store. |
| 426 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base, | 429 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base, |
| 427 const url::Origin& origin); | 430 const url::Origin& origin); |
| 428 static bool RecordCorruptionInfo(const base::FilePath& path_base, | 431 static bool RecordCorruptionInfo(const base::FilePath& path_base, |
| 429 const url::Origin& origin, | 432 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 | 688 // complete. While > 0, temporary journal entries may exist so out-of-band |
| 686 // journal cleaning must be deferred. | 689 // journal cleaning must be deferred. |
| 687 size_t committing_transaction_count_; | 690 size_t committing_transaction_count_; |
| 688 | 691 |
| 689 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); | 692 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
| 690 }; | 693 }; |
| 691 | 694 |
| 692 } // namespace content | 695 } // namespace content |
| 693 | 696 |
| 694 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 697 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |