| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_FACTORY_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 | 14 |
| 14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "content/browser/indexed_db/indexed_db_factory.h" | 17 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 17 | 18 |
| 18 namespace url { | 19 namespace url { |
| 19 class Origin; | 20 class Origin; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 class IndexedDBContextImpl; | 25 class IndexedDBContextImpl; |
| 25 | 26 |
| 26 class CONTENT_EXPORT IndexedDBFactoryImpl : public IndexedDBFactory { | 27 class CONTENT_EXPORT IndexedDBFactoryImpl : public IndexedDBFactory { |
| 27 public: | 28 public: |
| 28 explicit IndexedDBFactoryImpl(IndexedDBContextImpl* context); | 29 explicit IndexedDBFactoryImpl(IndexedDBContextImpl* context); |
| 29 | 30 |
| 30 // content::IndexedDBFactory overrides: | 31 // content::IndexedDBFactory overrides: |
| 31 void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, | 32 void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, |
| 32 bool forced_close) override; | 33 bool forced_close) override; |
| 33 | 34 |
| 34 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, | 35 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 35 const url::Origin& origin, | 36 const url::Origin& origin, |
| 36 const base::FilePath& data_directory, | 37 const base::FilePath& data_directory, |
| 37 net::URLRequestContext* request_context) override; | 38 scoped_refptr<net::URLRequestContextGetter> |
| 39 request_context_getter) override; |
| 38 void Open(const base::string16& name, | 40 void Open(const base::string16& name, |
| 39 std::unique_ptr<IndexedDBPendingConnection> connection, | 41 std::unique_ptr<IndexedDBPendingConnection> connection, |
| 40 net::URLRequestContext* request_context, | 42 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 41 const url::Origin& origin, | 43 const url::Origin& origin, |
| 42 const base::FilePath& data_directory) override; | 44 const base::FilePath& data_directory) override; |
| 43 | 45 |
| 44 void DeleteDatabase(const base::string16& name, | 46 void DeleteDatabase( |
| 45 net::URLRequestContext* request_context, | 47 const base::string16& name, |
| 46 scoped_refptr<IndexedDBCallbacks> callbacks, | 48 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 47 const url::Origin& origin, | 49 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 48 const base::FilePath& data_directory) override; | 50 const url::Origin& origin, |
| 51 const base::FilePath& data_directory) override; |
| 49 | 52 |
| 50 void HandleBackingStoreFailure(const url::Origin& origin) override; | 53 void HandleBackingStoreFailure(const url::Origin& origin) override; |
| 51 void HandleBackingStoreCorruption( | 54 void HandleBackingStoreCorruption( |
| 52 const url::Origin& origin, | 55 const url::Origin& origin, |
| 53 const IndexedDBDatabaseError& error) override; | 56 const IndexedDBDatabaseError& error) override; |
| 54 | 57 |
| 55 OriginDBs GetOpenDatabasesForOrigin(const url::Origin& origin) const override; | 58 OriginDBs GetOpenDatabasesForOrigin(const url::Origin& origin) const override; |
| 56 | 59 |
| 57 void ForceClose(const url::Origin& origin) override; | 60 void ForceClose(const url::Origin& origin) override; |
| 58 | 61 |
| 59 // Called by the IndexedDBContext destructor so the factory can do cleanup. | 62 // Called by the IndexedDBContext destructor so the factory can do cleanup. |
| 60 void ContextDestroyed() override; | 63 void ContextDestroyed() override; |
| 61 | 64 |
| 62 // Called by the IndexedDBActiveBlobRegistry. | 65 // Called by the IndexedDBActiveBlobRegistry. |
| 63 void ReportOutstandingBlobs(const url::Origin& origin, | 66 void ReportOutstandingBlobs(const url::Origin& origin, |
| 64 bool blobs_outstanding) override; | 67 bool blobs_outstanding) override; |
| 65 | 68 |
| 66 // Called by an IndexedDBDatabase when it is actually deleted. | 69 // Called by an IndexedDBDatabase when it is actually deleted. |
| 67 void DatabaseDeleted( | 70 void DatabaseDeleted( |
| 68 const IndexedDBDatabase::Identifier& identifier) override; | 71 const IndexedDBDatabase::Identifier& identifier) override; |
| 69 | 72 |
| 70 size_t GetConnectionCount(const url::Origin& origin) const override; | 73 size_t GetConnectionCount(const url::Origin& origin) const override; |
| 71 | 74 |
| 72 protected: | 75 protected: |
| 73 ~IndexedDBFactoryImpl() override; | 76 ~IndexedDBFactoryImpl() override; |
| 74 | 77 |
| 75 scoped_refptr<IndexedDBBackingStore> OpenBackingStore( | 78 scoped_refptr<IndexedDBBackingStore> OpenBackingStore( |
| 76 const url::Origin& origin, | 79 const url::Origin& origin, |
| 77 const base::FilePath& data_directory, | 80 const base::FilePath& data_directory, |
| 78 net::URLRequestContext* request_context, | 81 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 79 IndexedDBDataLossInfo* data_loss_info, | 82 IndexedDBDataLossInfo* data_loss_info, |
| 80 bool* disk_full, | 83 bool* disk_full, |
| 81 leveldb::Status* s) override; | 84 leveldb::Status* s) override; |
| 82 | 85 |
| 83 scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( | 86 scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( |
| 84 const url::Origin& origin, | 87 const url::Origin& origin, |
| 85 const base::FilePath& data_directory, | 88 const base::FilePath& data_directory, |
| 86 net::URLRequestContext* request_context, | 89 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 87 IndexedDBDataLossInfo* data_loss_info, | 90 IndexedDBDataLossInfo* data_loss_info, |
| 88 bool* disk_full, | 91 bool* disk_full, |
| 89 bool first_time, | 92 bool first_time, |
| 90 leveldb::Status* s) override; | 93 leveldb::Status* s) override; |
| 91 | 94 |
| 92 void ReleaseBackingStore(const url::Origin& origin, bool immediate); | 95 void ReleaseBackingStore(const url::Origin& origin, bool immediate); |
| 93 void CloseBackingStore(const url::Origin& origin); | 96 void CloseBackingStore(const url::Origin& origin); |
| 94 IndexedDBContextImpl* context() const { return context_; } | 97 IndexedDBContextImpl* context() const { return context_; } |
| 95 | 98 |
| 96 private: | 99 private: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 std::map<url::Origin, scoped_refptr<IndexedDBBackingStore>> | 134 std::map<url::Origin, scoped_refptr<IndexedDBBackingStore>> |
| 132 backing_stores_with_active_blobs_; | 135 backing_stores_with_active_blobs_; |
| 133 std::set<url::Origin> backends_opened_since_boot_; | 136 std::set<url::Origin> backends_opened_since_boot_; |
| 134 | 137 |
| 135 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryImpl); | 138 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryImpl); |
| 136 }; | 139 }; |
| 137 | 140 |
| 138 } // namespace content | 141 } // namespace content |
| 139 | 142 |
| 140 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ | 143 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| OLD | NEW |