| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 WriteDescriptorVec* new_files_to_write, | 252 WriteDescriptorVec* new_files_to_write, |
| 253 scoped_refptr<BlobWriteCallback> callback); | 253 scoped_refptr<BlobWriteCallback> callback); |
| 254 | 254 |
| 255 // Called by CommitPhaseTwo: Partition blob references in blobs_to_remove_ | 255 // Called by CommitPhaseTwo: Partition blob references in blobs_to_remove_ |
| 256 // into live (active references) and dead (no references). | 256 // into live (active references) and dead (no references). |
| 257 void PartitionBlobsToRemove(BlobJournalType* dead_blobs, | 257 void PartitionBlobsToRemove(BlobJournalType* dead_blobs, |
| 258 BlobJournalType* live_blobs) const; | 258 BlobJournalType* live_blobs) const; |
| 259 | 259 |
| 260 IndexedDBBackingStore* backing_store_; | 260 IndexedDBBackingStore* backing_store_; |
| 261 scoped_refptr<LevelDBTransaction> transaction_; | 261 scoped_refptr<LevelDBTransaction> transaction_; |
| 262 std::map<std::string, BlobChangeRecord*> blob_change_map_; | 262 std::map<std::string, std::unique_ptr<BlobChangeRecord>> blob_change_map_; |
| 263 std::map<std::string, BlobChangeRecord*> incognito_blob_map_; | 263 std::map<std::string, std::unique_ptr<BlobChangeRecord>> |
| 264 incognito_blob_map_; |
| 264 int64_t database_id_; | 265 int64_t database_id_; |
| 265 | 266 |
| 266 // List of blob files being newly written as part of this transaction. | 267 // List of blob files being newly written as part of this transaction. |
| 267 // These will be added to the primary blob journal prior to commit, then | 268 // These will be added to the primary blob journal prior to commit, then |
| 268 // removed after a successful commit. | 269 // removed after a successful commit. |
| 269 BlobJournalType blobs_to_write_; | 270 BlobJournalType blobs_to_write_; |
| 270 | 271 |
| 271 // List of blob files being deleted as part of this transaction. These will | 272 // List of blob files being deleted as part of this transaction. These will |
| 272 // be added to either the primary or live blob journal as appropriate | 273 // be added to either the primary or live blob journal as appropriate |
| 273 // following a successful commit. | 274 // following a successful commit. |
| 274 BlobJournalType blobs_to_remove_; | 275 BlobJournalType blobs_to_remove_; |
| 275 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; | 276 scoped_refptr<ChainedBlobWriter> chained_blob_writer_; |
| 276 | 277 |
| 277 // Set to true between CommitPhaseOne and CommitPhaseTwo/Rollback, to | 278 // Set to true between CommitPhaseOne and CommitPhaseTwo/Rollback, to |
| 278 // indicate that the committing_transaction_count_ on the backing store | 279 // indicate that the committing_transaction_count_ on the backing store |
| 279 // has been bumped, and journal cleaning should be deferred. | 280 // has been bumped, and journal cleaning should be deferred. |
| 280 bool committing_; | 281 bool committing_; |
| 282 |
| 283 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 281 }; | 284 }; |
| 282 | 285 |
| 283 class Cursor { | 286 class Cursor { |
| 284 public: | 287 public: |
| 285 enum IteratorState { READY = 0, SEEK }; | 288 enum IteratorState { READY = 0, SEEK }; |
| 286 | 289 |
| 287 virtual ~Cursor(); | 290 virtual ~Cursor(); |
| 288 | 291 |
| 289 struct CursorOptions { | 292 struct CursorOptions { |
| 290 CursorOptions(); | 293 CursorOptions(); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 // leveldb backing store to partition data by origin. It is a normalized | 648 // leveldb backing store to partition data by origin. It is a normalized |
| 646 // version of the origin URL with a versioning suffix appended, e.g. | 649 // version of the origin URL with a versioning suffix appended, e.g. |
| 647 // "http_localhost_81@1" Since only one origin is stored per backing store | 650 // "http_localhost_81@1" Since only one origin is stored per backing store |
| 648 // this is redundant but necessary for backwards compatibility; the suffix | 651 // this is redundant but necessary for backwards compatibility; the suffix |
| 649 // provides for future flexibility. | 652 // provides for future flexibility. |
| 650 const std::string origin_identifier_; | 653 const std::string origin_identifier_; |
| 651 | 654 |
| 652 net::URLRequestContext* request_context_; | 655 net::URLRequestContext* request_context_; |
| 653 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 656 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 654 std::set<int> child_process_ids_granted_; | 657 std::set<int> child_process_ids_granted_; |
| 655 std::map<std::string, BlobChangeRecord*> incognito_blob_map_; | 658 std::map<std::string, std::unique_ptr<BlobChangeRecord>> incognito_blob_map_; |
| 656 base::OneShotTimer journal_cleaning_timer_; | 659 base::OneShotTimer journal_cleaning_timer_; |
| 657 | 660 |
| 658 std::unique_ptr<LevelDBDatabase> db_; | 661 std::unique_ptr<LevelDBDatabase> db_; |
| 659 std::unique_ptr<LevelDBComparator> comparator_; | 662 std::unique_ptr<LevelDBComparator> comparator_; |
| 660 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ | 663 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ |
| 661 // will hold a reference to this backing store. | 664 // will hold a reference to this backing store. |
| 662 IndexedDBActiveBlobRegistry active_blob_registry_; | 665 IndexedDBActiveBlobRegistry active_blob_registry_; |
| 663 base::OneShotTimer close_timer_; | 666 base::OneShotTimer close_timer_; |
| 664 | 667 |
| 665 // Incremented whenever a transaction starts committing, decremented when | 668 // Incremented whenever a transaction starts committing, decremented when |
| 666 // complete. While > 0, temporary journal entries may exist so out-of-band | 669 // complete. While > 0, temporary journal entries may exist so out-of-band |
| 667 // journal cleaning must be deferred. | 670 // journal cleaning must be deferred. |
| 668 size_t committing_transaction_count_; | 671 size_t committing_transaction_count_; |
| 669 | 672 |
| 670 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); | 673 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); |
| 671 }; | 674 }; |
| 672 | 675 |
| 673 } // namespace content | 676 } // namespace content |
| 674 | 677 |
| 675 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ | 678 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ |
| OLD | NEW |