Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_backing_store.h
blobd7e5dbc217c24db517ce7af8df78df7b27c6edc5
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
8 #include <map>
9 #include <set>
10 #include <string>
11 #include <utility>
12 #include <vector>
14 #include "base/basictypes.h"
15 #include "base/files/file_path.h"
16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/strings/string_piece.h"
19 #include "base/time/time.h"
20 #include "base/timer/timer.h"
21 #include "content/browser/indexed_db/indexed_db.h"
22 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h"
23 #include "content/browser/indexed_db/indexed_db_blob_info.h"
24 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h"
25 #include "content/browser/indexed_db/indexed_db_metadata.h"
26 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h"
27 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h"
28 #include "content/common/content_export.h"
29 #include "content/common/indexed_db/indexed_db_key.h"
30 #include "content/common/indexed_db/indexed_db_key_path.h"
31 #include "content/common/indexed_db/indexed_db_key_range.h"
32 #include "storage/browser/blob/blob_data_handle.h"
33 #include "third_party/leveldatabase/src/include/leveldb/status.h"
34 #include "url/gurl.h"
36 namespace base {
37 class SequencedTaskRunner;
40 namespace storage {
41 class FileWriterDelegate;
44 namespace net {
45 class URLRequestContext;
48 namespace content {
50 class IndexedDBFactory;
51 class LevelDBComparator;
52 class LevelDBDatabase;
53 class LevelDBFactory;
54 struct IndexedDBValue;
56 class CONTENT_EXPORT IndexedDBBackingStore
57 : public base::RefCounted<IndexedDBBackingStore> {
58 public:
59 class CONTENT_EXPORT Comparator : public LevelDBComparator {
60 public:
61 int Compare(const base::StringPiece& a,
62 const base::StringPiece& b) const override;
63 const char* Name() const override;
66 class CONTENT_EXPORT RecordIdentifier {
67 public:
68 RecordIdentifier(const std::string& primary_key, int64 version);
69 RecordIdentifier();
70 ~RecordIdentifier();
72 const std::string& primary_key() const { return primary_key_; }
73 int64 version() const { return version_; }
74 void Reset(const std::string& primary_key, int64 version) {
75 primary_key_ = primary_key;
76 version_ = version;
79 private:
80 // TODO(jsbell): Make it more clear that this is the *encoded* version of
81 // the key.
82 std::string primary_key_;
83 int64 version_;
84 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier);
87 class BlobWriteCallback : public base::RefCounted<BlobWriteCallback> {
88 public:
89 virtual void Run(bool succeeded) = 0;
91 protected:
92 friend class base::RefCounted<BlobWriteCallback>;
93 virtual ~BlobWriteCallback() {}
96 class BlobChangeRecord {
97 public:
98 BlobChangeRecord(const std::string& key, int64 object_store_id);
99 ~BlobChangeRecord();
101 const std::string& key() const { return key_; }
102 int64 object_store_id() const { return object_store_id_; }
103 void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info);
104 std::vector<IndexedDBBlobInfo>& mutable_blob_info() { return blob_info_; }
105 const std::vector<IndexedDBBlobInfo>& blob_info() const {
106 return blob_info_;
108 void SetHandles(ScopedVector<storage::BlobDataHandle>* handles);
109 scoped_ptr<BlobChangeRecord> Clone() const;
111 private:
112 std::string key_;
113 int64 object_store_id_;
114 std::vector<IndexedDBBlobInfo> blob_info_;
115 ScopedVector<storage::BlobDataHandle> handles_;
116 DISALLOW_COPY_AND_ASSIGN(BlobChangeRecord);
118 typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap;
120 class CONTENT_EXPORT Transaction {
121 public:
122 explicit Transaction(IndexedDBBackingStore* backing_store);
123 virtual ~Transaction();
125 virtual void Begin();
127 // CommitPhaseOne determines what blobs (if any) need to be written to disk
128 // and updates the primary blob journal, and kicks off the async writing
129 // of the blob files. In case of crash/rollback, the journal indicates what
130 // files should be cleaned up.
131 // The callback will be called eventually on success or failure, or
132 // immediately if phase one is complete due to lack of any blobs to write.
133 virtual leveldb::Status CommitPhaseOne(scoped_refptr<BlobWriteCallback>);
135 // CommitPhaseTwo is called once the blob files (if any) have been written
136 // to disk, and commits the actual transaction to the backing store,
137 // including blob journal updates, then deletes any blob files deleted
138 // by the transaction and not referenced by running scripts.
139 virtual leveldb::Status CommitPhaseTwo();
141 virtual void Rollback();
142 void Reset() {
143 backing_store_ = NULL;
144 transaction_ = NULL;
146 leveldb::Status PutBlobInfoIfNeeded(
147 int64 database_id,
148 int64 object_store_id,
149 const std::string& object_store_data_key,
150 std::vector<IndexedDBBlobInfo>*,
151 ScopedVector<storage::BlobDataHandle>* handles);
152 void PutBlobInfo(int64 database_id,
153 int64 object_store_id,
154 const std::string& object_store_data_key,
155 std::vector<IndexedDBBlobInfo>*,
156 ScopedVector<storage::BlobDataHandle>* handles);
158 LevelDBTransaction* transaction() { return transaction_.get(); }
160 leveldb::Status GetBlobInfoForRecord(
161 int64 database_id,
162 const std::string& object_store_data_key,
163 IndexedDBValue* value);
165 // This holds a BlobEntryKey and the encoded IndexedDBBlobInfo vector stored
166 // under that key.
167 typedef std::vector<std::pair<BlobEntryKey, std::string> >
168 BlobEntryKeyValuePairVec;
170 class CONTENT_EXPORT WriteDescriptor {
171 public:
172 WriteDescriptor(const GURL& url,
173 int64_t key,
174 int64_t size,
175 base::Time last_modified);
176 WriteDescriptor(const base::FilePath& path,
177 int64_t key,
178 int64_t size,
179 base::Time last_modified);
180 WriteDescriptor(const WriteDescriptor& other);
181 ~WriteDescriptor();
182 WriteDescriptor& operator=(const WriteDescriptor& other);
184 bool is_file() const { return is_file_; }
185 const GURL& url() const {
186 DCHECK(!is_file_);
187 return url_;
189 const base::FilePath& file_path() const {
190 DCHECK(is_file_);
191 return file_path_;
193 int64_t key() const { return key_; }
194 int64_t size() const { return size_; }
195 base::Time last_modified() const { return last_modified_; }
197 private:
198 bool is_file_;
199 GURL url_;
200 base::FilePath file_path_;
201 int64_t key_;
202 int64_t size_;
203 base::Time last_modified_;
206 class ChainedBlobWriter
207 : public base::RefCountedThreadSafe<ChainedBlobWriter> {
208 public:
209 virtual void set_delegate(
210 scoped_ptr<storage::FileWriterDelegate> delegate) = 0;
212 // TODO(ericu): Add a reason in the event of failure.
213 virtual void ReportWriteCompletion(bool succeeded,
214 int64 bytes_written) = 0;
216 virtual void Abort() = 0;
218 protected:
219 friend class base::RefCountedThreadSafe<ChainedBlobWriter>;
220 virtual ~ChainedBlobWriter() {}
223 class ChainedBlobWriterImpl;
225 typedef std::vector<WriteDescriptor> WriteDescriptorVec;
227 private:
228 class BlobWriteCallbackWrapper;
230 // Called by CommitPhaseOne: Identifies the blob entries to write and adds
231 // them to the primary blob journal directly (i.e. not as part of the
232 // transaction). Populates blobs_to_write_.
233 leveldb::Status HandleBlobPreTransaction(
234 BlobEntryKeyValuePairVec* new_blob_entries,
235 WriteDescriptorVec* new_files_to_write);
237 // Called by CommitPhaseOne: Populates blob_files_to_remove_ by
238 // determining which blobs are deleted as part of the transaction, and
239 // adds blob entry cleanup operations to the transaction. Returns true on
240 // success, false on failure.
241 bool CollectBlobFilesToRemove();
243 // Called by CommitPhaseOne: Kicks off the asynchronous writes of blobs
244 // identified in HandleBlobPreTransaction. The callback will be called
245 // eventually on success or failure.
246 void WriteNewBlobs(BlobEntryKeyValuePairVec* new_blob_entries,
247 WriteDescriptorVec* new_files_to_write,
248 scoped_refptr<BlobWriteCallback> callback);
250 // Called by CommitPhaseTwo: Partition blob references in blobs_to_remove_
251 // into live (active references) and dead (no references).
252 void PartitionBlobsToRemove(BlobJournalType* dead_blobs,
253 BlobJournalType* live_blobs) const;
255 IndexedDBBackingStore* backing_store_;
256 scoped_refptr<LevelDBTransaction> transaction_;
257 BlobChangeMap blob_change_map_;
258 BlobChangeMap incognito_blob_map_;
259 int64 database_id_;
261 // List of blob files being newly written as part of this transaction.
262 // These will be added to the primary blob journal prior to commit, then
263 // removed after a sucessful commit.
264 BlobJournalType blobs_to_write_;
266 // List of blob files being deleted as part of this transaction. These will
267 // be added to either the primary or live blob journal as appropriate
268 // following a successful commit.
269 BlobJournalType blobs_to_remove_;
270 scoped_refptr<ChainedBlobWriter> chained_blob_writer_;
272 // Set to true between CommitPhaseOne and CommitPhaseTwo/Rollback, to
273 // indicate that the committing_transaction_count_ on the backing store
274 // has been bumped, and journal cleaning should be deferred.
275 bool committing_;
278 class Cursor {
279 public:
280 enum IteratorState { READY = 0, SEEK };
282 virtual ~Cursor();
284 struct CursorOptions {
285 CursorOptions();
286 ~CursorOptions();
287 int64 database_id;
288 int64 object_store_id;
289 int64 index_id;
290 std::string low_key;
291 bool low_open;
292 std::string high_key;
293 bool high_open;
294 bool forward;
295 bool unique;
298 const IndexedDBKey& key() const { return *current_key_; }
299 bool Continue(leveldb::Status* s) { return Continue(NULL, NULL, SEEK, s); }
300 bool Continue(const IndexedDBKey* key,
301 IteratorState state,
302 leveldb::Status* s) {
303 return Continue(key, NULL, state, s);
305 bool Continue(const IndexedDBKey* key,
306 const IndexedDBKey* primary_key,
307 IteratorState state,
308 leveldb::Status*);
309 bool Advance(uint32 count, leveldb::Status*);
310 bool FirstSeek(leveldb::Status*);
312 virtual Cursor* Clone() = 0;
313 virtual const IndexedDBKey& primary_key() const;
314 virtual IndexedDBValue* value() = 0;
315 virtual const RecordIdentifier& record_identifier() const;
316 virtual bool LoadCurrentRow() = 0;
318 protected:
319 Cursor(scoped_refptr<IndexedDBBackingStore> backing_store,
320 Transaction* transaction,
321 int64 database_id,
322 const CursorOptions& cursor_options);
323 explicit Cursor(const IndexedDBBackingStore::Cursor* other);
325 virtual std::string EncodeKey(const IndexedDBKey& key) = 0;
326 virtual std::string EncodeKey(const IndexedDBKey& key,
327 const IndexedDBKey& primary_key) = 0;
329 bool IsPastBounds() const;
330 bool HaveEnteredRange() const;
332 IndexedDBBackingStore* backing_store_;
333 Transaction* transaction_;
334 int64 database_id_;
335 const CursorOptions cursor_options_;
336 scoped_ptr<LevelDBIterator> iterator_;
337 scoped_ptr<IndexedDBKey> current_key_;
338 IndexedDBBackingStore::RecordIdentifier record_identifier_;
340 private:
341 DISALLOW_COPY_AND_ASSIGN(Cursor);
344 const GURL& origin_url() const { return origin_url_; }
345 IndexedDBFactory* factory() const { return indexed_db_factory_; }
346 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); }
347 base::OneShotTimer<IndexedDBBackingStore>* close_timer() {
348 return &close_timer_;
350 IndexedDBActiveBlobRegistry* active_blob_registry() {
351 return &active_blob_registry_;
354 static scoped_refptr<IndexedDBBackingStore> Open(
355 IndexedDBFactory* indexed_db_factory,
356 const GURL& origin_url,
357 const base::FilePath& path_base,
358 net::URLRequestContext* request_context,
359 blink::WebIDBDataLoss* data_loss,
360 std::string* data_loss_message,
361 bool* disk_full,
362 base::SequencedTaskRunner* task_runner,
363 bool clean_journal,
364 leveldb::Status* status);
365 static scoped_refptr<IndexedDBBackingStore> Open(
366 IndexedDBFactory* indexed_db_factory,
367 const GURL& origin_url,
368 const base::FilePath& path_base,
369 net::URLRequestContext* request_context,
370 blink::WebIDBDataLoss* data_loss,
371 std::string* data_loss_message,
372 bool* disk_full,
373 LevelDBFactory* leveldb_factory,
374 base::SequencedTaskRunner* task_runner,
375 bool clean_journal,
376 leveldb::Status* status);
377 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
378 const GURL& origin_url,
379 base::SequencedTaskRunner* task_runner,
380 leveldb::Status* status);
381 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
382 const GURL& origin_url,
383 LevelDBFactory* leveldb_factory,
384 base::SequencedTaskRunner* task_runner,
385 leveldb::Status* status);
387 void GrantChildProcessPermissions(int child_process_id);
389 // Compact is public for testing.
390 virtual void Compact();
391 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status*);
392 virtual leveldb::Status GetIDBDatabaseMetaData(
393 const base::string16& name,
394 IndexedDBDatabaseMetadata* metadata,
395 bool* success) WARN_UNUSED_RESULT;
396 virtual leveldb::Status CreateIDBDatabaseMetaData(
397 const base::string16& name,
398 const base::string16& version,
399 int64 int_version,
400 int64* row_id);
401 virtual bool UpdateIDBDatabaseIntVersion(
402 IndexedDBBackingStore::Transaction* transaction,
403 int64 row_id,
404 int64 int_version);
405 virtual leveldb::Status DeleteDatabase(const base::string16& name);
407 // Assumes caller has already closed the backing store.
408 static leveldb::Status DestroyBackingStore(const base::FilePath& path_base,
409 const GURL& origin_url);
410 static bool RecordCorruptionInfo(const base::FilePath& path_base,
411 const GURL& origin_url,
412 const std::string& message);
413 leveldb::Status GetObjectStores(
414 int64 database_id,
415 IndexedDBDatabaseMetadata::ObjectStoreMap* map) WARN_UNUSED_RESULT;
416 virtual leveldb::Status CreateObjectStore(
417 IndexedDBBackingStore::Transaction* transaction,
418 int64 database_id,
419 int64 object_store_id,
420 const base::string16& name,
421 const IndexedDBKeyPath& key_path,
422 bool auto_increment);
423 virtual leveldb::Status DeleteObjectStore(
424 IndexedDBBackingStore::Transaction* transaction,
425 int64 database_id,
426 int64 object_store_id) WARN_UNUSED_RESULT;
428 virtual leveldb::Status GetRecord(
429 IndexedDBBackingStore::Transaction* transaction,
430 int64 database_id,
431 int64 object_store_id,
432 const IndexedDBKey& key,
433 IndexedDBValue* record) WARN_UNUSED_RESULT;
434 virtual leveldb::Status PutRecord(
435 IndexedDBBackingStore::Transaction* transaction,
436 int64 database_id,
437 int64 object_store_id,
438 const IndexedDBKey& key,
439 IndexedDBValue* value,
440 ScopedVector<storage::BlobDataHandle>* handles,
441 RecordIdentifier* record) WARN_UNUSED_RESULT;
442 virtual leveldb::Status ClearObjectStore(
443 IndexedDBBackingStore::Transaction* transaction,
444 int64 database_id,
445 int64 object_store_id) WARN_UNUSED_RESULT;
446 virtual leveldb::Status DeleteRecord(
447 IndexedDBBackingStore::Transaction* transaction,
448 int64 database_id,
449 int64 object_store_id,
450 const RecordIdentifier& record) WARN_UNUSED_RESULT;
451 virtual leveldb::Status DeleteRange(
452 IndexedDBBackingStore::Transaction* transaction,
453 int64 database_id,
454 int64 object_store_id,
455 const IndexedDBKeyRange&) WARN_UNUSED_RESULT;
456 virtual leveldb::Status GetKeyGeneratorCurrentNumber(
457 IndexedDBBackingStore::Transaction* transaction,
458 int64 database_id,
459 int64 object_store_id,
460 int64* current_number) WARN_UNUSED_RESULT;
461 virtual leveldb::Status MaybeUpdateKeyGeneratorCurrentNumber(
462 IndexedDBBackingStore::Transaction* transaction,
463 int64 database_id,
464 int64 object_store_id,
465 int64 new_state,
466 bool check_current) WARN_UNUSED_RESULT;
467 virtual leveldb::Status KeyExistsInObjectStore(
468 IndexedDBBackingStore::Transaction* transaction,
469 int64 database_id,
470 int64 object_store_id,
471 const IndexedDBKey& key,
472 RecordIdentifier* found_record_identifier,
473 bool* found) WARN_UNUSED_RESULT;
475 virtual leveldb::Status CreateIndex(
476 IndexedDBBackingStore::Transaction* transaction,
477 int64 database_id,
478 int64 object_store_id,
479 int64 index_id,
480 const base::string16& name,
481 const IndexedDBKeyPath& key_path,
482 bool is_unique,
483 bool is_multi_entry) WARN_UNUSED_RESULT;
484 virtual leveldb::Status DeleteIndex(
485 IndexedDBBackingStore::Transaction* transaction,
486 int64 database_id,
487 int64 object_store_id,
488 int64 index_id) WARN_UNUSED_RESULT;
489 virtual leveldb::Status PutIndexDataForRecord(
490 IndexedDBBackingStore::Transaction* transaction,
491 int64 database_id,
492 int64 object_store_id,
493 int64 index_id,
494 const IndexedDBKey& key,
495 const RecordIdentifier& record) WARN_UNUSED_RESULT;
496 virtual leveldb::Status GetPrimaryKeyViaIndex(
497 IndexedDBBackingStore::Transaction* transaction,
498 int64 database_id,
499 int64 object_store_id,
500 int64 index_id,
501 const IndexedDBKey& key,
502 scoped_ptr<IndexedDBKey>* primary_key) WARN_UNUSED_RESULT;
503 virtual leveldb::Status KeyExistsInIndex(
504 IndexedDBBackingStore::Transaction* transaction,
505 int64 database_id,
506 int64 object_store_id,
507 int64 index_id,
508 const IndexedDBKey& key,
509 scoped_ptr<IndexedDBKey>* found_primary_key,
510 bool* exists) WARN_UNUSED_RESULT;
512 // Public for IndexedDBActiveBlobRegistry::ReleaseBlobRef.
513 virtual void ReportBlobUnused(int64 database_id, int64 blob_key);
515 base::FilePath GetBlobFileName(int64 database_id, int64 key) const;
517 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor(
518 IndexedDBBackingStore::Transaction* transaction,
519 int64 database_id,
520 int64 object_store_id,
521 const IndexedDBKeyRange& key_range,
522 blink::WebIDBCursorDirection,
523 leveldb::Status*);
524 virtual scoped_ptr<Cursor> OpenObjectStoreCursor(
525 IndexedDBBackingStore::Transaction* transaction,
526 int64 database_id,
527 int64 object_store_id,
528 const IndexedDBKeyRange& key_range,
529 blink::WebIDBCursorDirection,
530 leveldb::Status*);
531 virtual scoped_ptr<Cursor> OpenIndexKeyCursor(
532 IndexedDBBackingStore::Transaction* transaction,
533 int64 database_id,
534 int64 object_store_id,
535 int64 index_id,
536 const IndexedDBKeyRange& key_range,
537 blink::WebIDBCursorDirection,
538 leveldb::Status*);
539 virtual scoped_ptr<Cursor> OpenIndexCursor(
540 IndexedDBBackingStore::Transaction* transaction,
541 int64 database_id,
542 int64 object_store_id,
543 int64 index_id,
544 const IndexedDBKeyRange& key_range,
545 blink::WebIDBCursorDirection,
546 leveldb::Status*);
548 protected:
549 friend class base::RefCounted<IndexedDBBackingStore>;
551 IndexedDBBackingStore(IndexedDBFactory* indexed_db_factory,
552 const GURL& origin_url,
553 const base::FilePath& blob_path,
554 net::URLRequestContext* request_context,
555 scoped_ptr<LevelDBDatabase> db,
556 scoped_ptr<LevelDBComparator> comparator,
557 base::SequencedTaskRunner* task_runner);
558 virtual ~IndexedDBBackingStore();
560 bool is_incognito() const { return !indexed_db_factory_; }
562 leveldb::Status SetUpMetadata();
564 virtual bool WriteBlobFile(
565 int64 database_id,
566 const Transaction::WriteDescriptor& descriptor,
567 Transaction::ChainedBlobWriter* chained_blob_writer);
569 // Remove the referenced file on disk.
570 virtual bool RemoveBlobFile(int64 database_id, int64 key) const;
572 // Schedule a call to CleanPrimaryJournalIgnoreReturn() via
573 // an owned timer. If this object is destroyed, the timer
574 // will automatically be cancelled.
575 virtual void StartJournalCleaningTimer();
577 // Attempt to clean the primary journal. This will remove
578 // any referenced files and delete the journal entry. If any
579 // transaction is currently committing this will be deferred
580 // via StartJournalCleaningTimer().
581 void CleanPrimaryJournalIgnoreReturn();
583 private:
584 static scoped_refptr<IndexedDBBackingStore> Create(
585 IndexedDBFactory* indexed_db_factory,
586 const GURL& origin_url,
587 const base::FilePath& blob_path,
588 net::URLRequestContext* request_context,
589 scoped_ptr<LevelDBDatabase> db,
590 scoped_ptr<LevelDBComparator> comparator,
591 base::SequencedTaskRunner* task_runner,
592 leveldb::Status* status);
594 static bool ReadCorruptionInfo(const base::FilePath& path_base,
595 const GURL& origin_url,
596 std::string* message);
598 leveldb::Status FindKeyInIndex(
599 IndexedDBBackingStore::Transaction* transaction,
600 int64 database_id,
601 int64 object_store_id,
602 int64 index_id,
603 const IndexedDBKey& key,
604 std::string* found_encoded_primary_key,
605 bool* found);
606 leveldb::Status GetIndexes(int64 database_id,
607 int64 object_store_id,
608 IndexedDBObjectStoreMetadata::IndexMap* map)
609 WARN_UNUSED_RESULT;
611 // Remove the blob directory for the specified database and all contained
612 // blob files.
613 bool RemoveBlobDirectory(int64 database_id) const;
615 // Synchronously read the key-specified blob journal entry from the backing
616 // store, delete all referenced blob files, and erase the journal entry.
617 // This must not be used while temporary entries are present e.g. during
618 // a two-stage transaction commit with blobs.
619 leveldb::Status CleanUpBlobJournal(const std::string& level_db_key) const;
621 // Synchronously delete the files and/or directories on disk referenced by
622 // the blob journal.
623 leveldb::Status CleanUpBlobJournalEntries(
624 const BlobJournalType& journal) const;
626 IndexedDBFactory* indexed_db_factory_;
627 const GURL origin_url_;
628 base::FilePath blob_path_;
630 // The origin identifier is a key prefix unique to the origin used in the
631 // leveldb backing store to partition data by origin. It is a normalized
632 // version of the origin URL with a versioning suffix appended, e.g.
633 // "http_localhost_81@1" Since only one origin is stored per backing store
634 // this is redundant but necessary for backwards compatibility; the suffix
635 // provides for future flexibility.
636 const std::string origin_identifier_;
638 net::URLRequestContext* request_context_;
639 scoped_refptr<base::SequencedTaskRunner> task_runner_;
640 std::set<int> child_process_ids_granted_;
641 BlobChangeMap incognito_blob_map_;
642 base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_;
644 scoped_ptr<LevelDBDatabase> db_;
645 scoped_ptr<LevelDBComparator> comparator_;
646 // Whenever blobs are registered in active_blob_registry_, indexed_db_factory_
647 // will hold a reference to this backing store.
648 IndexedDBActiveBlobRegistry active_blob_registry_;
649 base::OneShotTimer<IndexedDBBackingStore> close_timer_;
651 // Incremented whenever a transaction starts committing, decremented when
652 // complete. While > 0, temporary journal entries may exist so out-of-band
653 // journal cleaning must be deferred.
654 size_t committing_transaction_count_;
656 DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStore);
659 } // namespace content
661 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_