| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, DatabaseFailedOpen); | 97 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, DatabaseFailedOpen); |
| 98 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, | 98 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, |
| 99 DeleteDatabaseClosesBackingStore); | 99 DeleteDatabaseClosesBackingStore); |
| 100 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, | 100 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, |
| 101 ForceCloseReleasesBackingStore); | 101 ForceCloseReleasesBackingStore); |
| 102 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, | 102 FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, |
| 103 GetDatabaseNamesClosesBackingStore); | 103 GetDatabaseNamesClosesBackingStore); |
| 104 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, | 104 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, |
| 105 ForceCloseOpenDatabasesOnCommitFailure); | 105 ForceCloseOpenDatabasesOnCommitFailure); |
| 106 | 106 |
| 107 typedef std::map<IndexedDBDatabase::Identifier, IndexedDBDatabase*> |
| 108 IndexedDBDatabaseMap; |
| 109 typedef std::map<GURL, scoped_refptr<IndexedDBBackingStore> > |
| 110 IndexedDBBackingStoreMap; |
| 111 |
| 107 // Called internally after a database is closed, with some delay. If this | 112 // Called internally after a database is closed, with some delay. If this |
| 108 // factory has the last reference, it will be released. | 113 // factory has the last reference, it will be released. |
| 109 void MaybeCloseBackingStore(const GURL& origin_url); | 114 void MaybeCloseBackingStore(const GURL& origin_url); |
| 110 bool HasLastBackingStoreReference(const GURL& origin_url) const; | 115 bool HasLastBackingStoreReference(const GURL& origin_url) const; |
| 111 | 116 |
| 112 // Testing helpers, so unit tests don't need to grovel through internal state. | 117 // Testing helpers, so unit tests don't need to grovel through internal state. |
| 113 bool IsDatabaseOpen(const GURL& origin_url, const base::string16& name) const; | 118 bool IsDatabaseOpen(const GURL& origin_url, const base::string16& name) const; |
| 114 bool IsBackingStoreOpen(const GURL& origin_url) const; | 119 bool IsBackingStoreOpen(const GURL& origin_url) const; |
| 115 bool IsBackingStorePendingClose(const GURL& origin_url) const; | 120 bool IsBackingStorePendingClose(const GURL& origin_url) const; |
| 116 void RemoveDatabaseFromMaps(const IndexedDBDatabase::Identifier& identifier); | 121 void RemoveDatabaseFromMaps(const IndexedDBDatabase::Identifier& identifier); |
| 117 | 122 |
| 118 IndexedDBContextImpl* context_; | 123 IndexedDBContextImpl* context_; |
| 119 | 124 |
| 120 typedef std::map<IndexedDBDatabase::Identifier, IndexedDBDatabase*> | |
| 121 IndexedDBDatabaseMap; | |
| 122 IndexedDBDatabaseMap database_map_; | 125 IndexedDBDatabaseMap database_map_; |
| 123 OriginDBMap origin_dbs_; | 126 OriginDBMap origin_dbs_; |
| 124 | |
| 125 typedef std::map<GURL, scoped_refptr<IndexedDBBackingStore> > | |
| 126 IndexedDBBackingStoreMap; | |
| 127 IndexedDBBackingStoreMap backing_store_map_; | 127 IndexedDBBackingStoreMap backing_store_map_; |
| 128 | 128 |
| 129 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; | 129 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; |
| 130 IndexedDBBackingStoreMap backing_stores_with_active_blobs_; | 130 IndexedDBBackingStoreMap backing_stores_with_active_blobs_; |
| 131 std::set<GURL> backends_opened_since_boot_; | 131 std::set<GURL> backends_opened_since_boot_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryImpl); | 133 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryImpl); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace content | 136 } // namespace content |
| 137 | 137 |
| 138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ | 138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| OLD | NEW |