OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" |
| 14 #include "content/browser/indexed_db/indexed_db_database_callbacks_wrapper.h" |
| 15 #include "content/browser/indexed_db/indexed_db_factory.h" |
| 16 #include "content/common/content_export.h" |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class DOMStringList; |
| 21 |
| 22 class IndexedDBBackingStore; |
| 23 class IndexedDBDatabaseImpl; |
| 24 |
| 25 class CONTENT_EXPORT IndexedDBFactoryImpl : public IndexedDBFactory { |
| 26 public: |
| 27 static scoped_refptr<IndexedDBFactoryImpl> Create() { |
| 28 return make_scoped_refptr(new IndexedDBFactoryImpl()); |
| 29 } |
| 30 |
| 31 // Notifications from weak pointers. |
| 32 virtual void RemoveIDBDatabaseBackend(const string16& unique_identifier); |
| 33 |
| 34 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacksWrapper>, |
| 35 const string16& database_identifier, |
| 36 ScriptExecutionContext*, |
| 37 const string16& data_dir) OVERRIDE; |
| 38 virtual void Open(const string16& name, |
| 39 int64_t version, |
| 40 int64_t transaction_id, |
| 41 scoped_refptr<IndexedDBCallbacksWrapper>, |
| 42 scoped_refptr<IndexedDBDatabaseCallbacksWrapper>, |
| 43 const string16& database_identifier, |
| 44 ScriptExecutionContext*, |
| 45 const string16& data_dir) OVERRIDE; |
| 46 |
| 47 virtual void DeleteDatabase(const string16& name, |
| 48 scoped_refptr<IndexedDBCallbacksWrapper>, |
| 49 const string16& database_identifier, |
| 50 ScriptExecutionContext*, |
| 51 const string16& data_dir) OVERRIDE; |
| 52 |
| 53 protected: |
| 54 IndexedDBFactoryImpl(); |
| 55 virtual ~IndexedDBFactoryImpl(); |
| 56 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( |
| 57 const string16& database_identifier, |
| 58 const string16& data_dir); |
| 59 |
| 60 private: |
| 61 |
| 62 typedef std::map<string16, scoped_refptr<IndexedDBDatabaseImpl> > |
| 63 IndexedDBDatabaseMap; |
| 64 IndexedDBDatabaseMap database_backend_map_; |
| 65 |
| 66 typedef std::map<string16, base::WeakPtr<IndexedDBBackingStore> > |
| 67 IndexedDBBackingStoreMap; |
| 68 IndexedDBBackingStoreMap backing_store_map_; |
| 69 |
| 70 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; |
| 71 |
| 72 // Only one instance of the factory should exist at any given time. |
| 73 static IndexedDBFactoryImpl* idb_factory_backend_impl; |
| 74 }; |
| 75 |
| 76 } // namespace content |
| 77 |
| 78 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
OLD | NEW |