Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_backing_store.h |
| diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h |
| index 8e5f7ac0de74b28a9c8233e6f638297da3c46907..d074613263554ec932f49ec390834f6dddb1cc22 100644 |
| --- a/content/browser/indexed_db/indexed_db_backing_store.h |
| +++ b/content/browser/indexed_db/indexed_db_backing_store.h |
| @@ -14,6 +14,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/timer/timer.h" |
| #include "content/browser/indexed_db/indexed_db.h" |
| +#include "content/browser/indexed_db/indexed_db_active_blob_registry.h" |
| #include "content/browser/indexed_db/indexed_db_metadata.h" |
| #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| @@ -24,8 +25,13 @@ |
| #include "third_party/leveldatabase/src/include/leveldb/status.h" |
| #include "url/gurl.h" |
| +namespace base { |
| +class TaskRunner; |
| +} |
| + |
| namespace content { |
| +class IndexedDBFactory; |
| class LevelDBComparator; |
| class LevelDBDatabase; |
| struct IndexedDBValue; |
| @@ -46,29 +52,40 @@ class CONTENT_EXPORT IndexedDBBackingStore |
| class CONTENT_EXPORT Transaction; |
| const GURL& origin_url() const { return origin_url_; } |
| + IndexedDBFactory* factory() const { return indexed_db_factory_; } |
| + base::TaskRunner* task_runner() const { return task_runner_; } |
| base::OneShotTimer<IndexedDBBackingStore>* close_timer() { |
| return &close_timer_; |
| } |
| + IndexedDBActiveBlobRegistry* active_blob_registry() { |
| + return &active_blob_registry_; |
| + } |
| static scoped_refptr<IndexedDBBackingStore> Open( |
| + IndexedDBFactory* indexed_db_factory, |
| const GURL& origin_url, |
| const base::FilePath& path_base, |
| blink::WebIDBDataLoss* data_loss, |
| std::string* data_loss_message, |
| - bool* disk_full); |
| + bool* disk_full, |
| + base::TaskRunner* task_runner); |
| static scoped_refptr<IndexedDBBackingStore> Open( |
| + IndexedDBFactory* indexed_db_factory, |
| const GURL& origin_url, |
| const base::FilePath& path_base, |
| blink::WebIDBDataLoss* data_loss, |
| std::string* data_loss_message, |
| bool* disk_full, |
| - LevelDBFactory* factory); |
| + LevelDBFactory* leveldb_factory, |
| + base::TaskRunner* task_runner); |
| static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
| - const GURL& origin_url); |
| + const GURL& origin_url, |
| + base::TaskRunner* task_runner); |
| static scoped_refptr<IndexedDBBackingStore> OpenInMemory( |
| const GURL& origin_url, |
| - LevelDBFactory* factory); |
| + LevelDBFactory* level_db_factory, |
| + base::TaskRunner* task_runner); |
| virtual std::vector<base::string16> GetDatabaseNames(); |
| virtual leveldb::Status GetIDBDatabaseMetaData( |
| @@ -200,6 +217,9 @@ class CONTENT_EXPORT IndexedDBBackingStore |
| scoped_ptr<IndexedDBKey>* found_primary_key, |
| bool* exists) WARN_UNUSED_RESULT; |
| + // Public for IndexedDBActiveBlobRegistry::ReleaseBlobRef. |
| + virtual void ReportBlobUnused(int64 database_id, int64 blob_key); |
| + |
| class Cursor { |
| public: |
| virtual ~Cursor(); |
| @@ -306,17 +326,21 @@ class CONTENT_EXPORT IndexedDBBackingStore |
| }; |
| protected: |
| - IndexedDBBackingStore(const GURL& origin_url, |
| + IndexedDBBackingStore(IndexedDBFactory* indexed_db_factory, |
| + const GURL& origin_url, |
| scoped_ptr<LevelDBDatabase> db, |
| - scoped_ptr<LevelDBComparator> comparator); |
| + scoped_ptr<LevelDBComparator> comparator, |
| + base::TaskRunner* task_runner); |
| virtual ~IndexedDBBackingStore(); |
| friend class base::RefCounted<IndexedDBBackingStore>; |
| private: |
| static scoped_refptr<IndexedDBBackingStore> Create( |
| + IndexedDBFactory* indexed_db_factory, |
| const GURL& origin_url, |
| scoped_ptr<LevelDBDatabase> db, |
| - scoped_ptr<LevelDBComparator> comparator); |
| + scoped_ptr<LevelDBComparator> comparator, |
| + base::TaskRunner* task_runner); |
| leveldb::Status FindKeyInIndex( |
| IndexedDBBackingStore::Transaction* transaction, |
| @@ -331,6 +355,7 @@ class CONTENT_EXPORT IndexedDBBackingStore |
| IndexedDBObjectStoreMetadata::IndexMap* map) |
| WARN_UNUSED_RESULT; |
| + IndexedDBFactory* indexed_db_factory_; |
| const GURL origin_url_; |
| // The origin identifier is a key prefix unique to the origin used in the |
| @@ -340,9 +365,13 @@ class CONTENT_EXPORT IndexedDBBackingStore |
| // this is redundant but necessary for backwards compatibility; the suffix |
| // provides for future flexibility. |
| const std::string origin_identifier_; |
| + base::TaskRunner* task_runner_; |
| scoped_ptr<LevelDBDatabase> db_; |
| scoped_ptr<LevelDBComparator> comparator_; |
| + // The active_blob_registry_ will hold a refcount to this backing store |
|
jsbell
2014/03/20 18:04:33
Does it?
ericu
2014/03/25 01:22:14
Fixed.
|
| + // whenever any live blobs are registered with it. |
| + IndexedDBActiveBlobRegistry active_blob_registry_; |
| base::OneShotTimer<IndexedDBBackingStore> close_timer_; |
| }; |