Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: content/browser/indexed_db/indexed_db_backing_store.h

Issue 2245833003: Indexed DB: Hold BlobChangeRecords in maps using smart pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@idb-unique
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // leveldb backing store to partition data by origin. It is a normalized 646 // 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. 647 // 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 648 // "http_localhost_81@1" Since only one origin is stored per backing store
648 // this is redundant but necessary for backwards compatibility; the suffix 649 // this is redundant but necessary for backwards compatibility; the suffix
649 // provides for future flexibility. 650 // provides for future flexibility.
650 const std::string origin_identifier_; 651 const std::string origin_identifier_;
651 652
652 net::URLRequestContext* request_context_; 653 net::URLRequestContext* request_context_;
653 scoped_refptr<base::SequencedTaskRunner> task_runner_; 654 scoped_refptr<base::SequencedTaskRunner> task_runner_;
654 std::set<int> child_process_ids_granted_; 655 std::set<int> child_process_ids_granted_;
655 std::map<std::string, BlobChangeRecord*> incognito_blob_map_; 656 std::map<std::string, std::unique_ptr<BlobChangeRecord>> incognito_blob_map_;
656 base::OneShotTimer journal_cleaning_timer_; 657 base::OneShotTimer journal_cleaning_timer_;
657 658
658 std::unique_ptr<LevelDBDatabase> db_; 659 std::unique_ptr<LevelDBDatabase> db_;
659 std::unique_ptr<LevelDBComparator> comparator_; 660 std::unique_ptr<LevelDBComparator> comparator_;
660 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_ 661 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_
661 // will hold a reference to this backing store. 662 // will hold a reference to this backing store.
662 IndexedDBActiveBlobRegistry active_blob_registry_; 663 IndexedDBActiveBlobRegistry active_blob_registry_;
663 base::OneShotTimer close_timer_; 664 base::OneShotTimer close_timer_;
664 665
665 // Incremented whenever a transaction starts committing, decremented when 666 // Incremented whenever a transaction starts committing, decremented when
666 // complete. While > 0, temporary journal entries may exist so out-of-band 667 // complete. While > 0, temporary journal entries may exist so out-of-band
667 // journal cleaning must be deferred. 668 // journal cleaning must be deferred.
668 size_t committing_transaction_count_; 669 size_t committing_transaction_count_;
669 670
670 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore); 671 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore);
671 }; 672 };
672 673
673 } // namespace content 674 } // namespace content
674 675
675 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 676 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698