| OLD | NEW |
| 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_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 class IndexedDBBackingStore; | 32 class IndexedDBBackingStore; |
| 33 struct IndexedDBPendingConnection; | 33 struct IndexedDBPendingConnection; |
| 34 | 34 |
| 35 class CONTENT_EXPORT IndexedDBFactory | 35 class CONTENT_EXPORT IndexedDBFactory |
| 36 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { | 36 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { |
| 37 public: | 37 public: |
| 38 typedef std::multimap<GURL, IndexedDBDatabase*> OriginDBMap; | 38 typedef std::multimap<url::Origin, IndexedDBDatabase*> OriginDBMap; |
| 39 typedef OriginDBMap::const_iterator OriginDBMapIterator; | 39 typedef OriginDBMap::const_iterator OriginDBMapIterator; |
| 40 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; | 40 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; |
| 41 | 41 |
| 42 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, | 42 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, |
| 43 bool forced_close) = 0; | 43 bool forced_close) = 0; |
| 44 | 44 |
| 45 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, | 45 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 46 const url::Origin& origin, | 46 const url::Origin& origin, |
| 47 const base::FilePath& data_directory, | 47 const base::FilePath& data_directory, |
| 48 net::URLRequestContext* request_context) = 0; | 48 net::URLRequestContext* request_context) = 0; |
| 49 virtual void Open(const base::string16& name, | 49 virtual void Open(const base::string16& name, |
| 50 const IndexedDBPendingConnection& connection, | 50 const IndexedDBPendingConnection& connection, |
| 51 net::URLRequestContext* request_context, | 51 net::URLRequestContext* request_context, |
| 52 const url::Origin& origin, | 52 const url::Origin& origin, |
| 53 const base::FilePath& data_directory) = 0; | 53 const base::FilePath& data_directory) = 0; |
| 54 | 54 |
| 55 virtual void DeleteDatabase(const base::string16& name, | 55 virtual void DeleteDatabase(const base::string16& name, |
| 56 net::URLRequestContext* request_context, | 56 net::URLRequestContext* request_context, |
| 57 scoped_refptr<IndexedDBCallbacks> callbacks, | 57 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 58 const url::Origin& origin, | 58 const url::Origin& origin, |
| 59 const base::FilePath& data_directory) = 0; | 59 const base::FilePath& data_directory) = 0; |
| 60 | 60 |
| 61 virtual void HandleBackingStoreFailure(const GURL& origin_url) = 0; | 61 virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0; |
| 62 virtual void HandleBackingStoreCorruption( | 62 virtual void HandleBackingStoreCorruption( |
| 63 const GURL& origin_url, | 63 const url::Origin& origin, |
| 64 const IndexedDBDatabaseError& error) = 0; | 64 const IndexedDBDatabaseError& error) = 0; |
| 65 | 65 |
| 66 virtual OriginDBs GetOpenDatabasesForOrigin(const GURL& origin_url) const = 0; | 66 virtual OriginDBs GetOpenDatabasesForOrigin( |
| 67 const url::Origin& origin) const = 0; |
| 67 | 68 |
| 68 virtual void ForceClose(const GURL& origin_url) = 0; | 69 virtual void ForceClose(const url::Origin& origin) = 0; |
| 69 | 70 |
| 70 // Called by the IndexedDBContext destructor so the factory can do cleanup. | 71 // Called by the IndexedDBContext destructor so the factory can do cleanup. |
| 71 virtual void ContextDestroyed() = 0; | 72 virtual void ContextDestroyed() = 0; |
| 72 | 73 |
| 73 // Called by the IndexedDBActiveBlobRegistry. | 74 // Called by the IndexedDBActiveBlobRegistry. |
| 74 virtual void ReportOutstandingBlobs(const GURL& origin_url, | 75 virtual void ReportOutstandingBlobs(const url::Origin& origin, |
| 75 bool blobs_outstanding) = 0; | 76 bool blobs_outstanding) = 0; |
| 76 | 77 |
| 77 // Called by an IndexedDBDatabase when it is actually deleted. | 78 // Called by an IndexedDBDatabase when it is actually deleted. |
| 78 virtual void DatabaseDeleted( | 79 virtual void DatabaseDeleted( |
| 79 const IndexedDBDatabase::Identifier& identifier) = 0; | 80 const IndexedDBDatabase::Identifier& identifier) = 0; |
| 80 | 81 |
| 81 virtual size_t GetConnectionCount(const GURL& origin_url) const = 0; | 82 virtual size_t GetConnectionCount(const url::Origin& origin) const = 0; |
| 82 | 83 |
| 83 protected: | 84 protected: |
| 84 friend class base::RefCountedThreadSafe<IndexedDBFactory>; | 85 friend class base::RefCountedThreadSafe<IndexedDBFactory>; |
| 85 | 86 |
| 86 IndexedDBFactory() {} | 87 IndexedDBFactory() {} |
| 87 virtual ~IndexedDBFactory() {} | 88 virtual ~IndexedDBFactory() {} |
| 88 | 89 |
| 89 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( | 90 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( |
| 90 const GURL& origin_url, | 91 const url::Origin& origin, |
| 91 const base::FilePath& data_directory, | 92 const base::FilePath& data_directory, |
| 92 net::URLRequestContext* request_context, | 93 net::URLRequestContext* request_context, |
| 93 blink::WebIDBDataLoss* data_loss, | 94 blink::WebIDBDataLoss* data_loss, |
| 94 std::string* data_loss_reason, | 95 std::string* data_loss_reason, |
| 95 bool* disk_full, | 96 bool* disk_full, |
| 96 leveldb::Status* status) = 0; | 97 leveldb::Status* status) = 0; |
| 97 | 98 |
| 98 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( | 99 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( |
| 99 const GURL& origin_url, | 100 const url::Origin& origin, |
| 100 const base::FilePath& data_directory, | 101 const base::FilePath& data_directory, |
| 101 net::URLRequestContext* request_context, | 102 net::URLRequestContext* request_context, |
| 102 blink::WebIDBDataLoss* data_loss, | 103 blink::WebIDBDataLoss* data_loss, |
| 103 std::string* data_loss_message, | 104 std::string* data_loss_message, |
| 104 bool* disk_full, | 105 bool* disk_full, |
| 105 bool first_time, | 106 bool first_time, |
| 106 leveldb::Status* status) = 0; | 107 leveldb::Status* status) = 0; |
| 107 | 108 |
| 108 private: | 109 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); | 110 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } // namespace content | 113 } // namespace content |
| 113 | 114 |
| 114 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 115 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
| OLD | NEW |