| 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/basictypes.h" | |
| 12 #include "base/files/file_path.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "base/memory/weak_ptr.h" | |
| 15 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" | |
| 16 #include "content/browser/indexed_db/indexed_db_database_callbacks_wrapper.h" | |
| 17 #include "content/browser/indexed_db/indexed_db_factory.h" | |
| 18 #include "content/common/content_export.h" | |
| 19 | |
| 20 namespace content { | |
| 21 | |
| 22 class IndexedDBBackingStore; | |
| 23 class IndexedDBDatabaseImpl; | |
| 24 | |
| 25 class CONTENT_EXPORT IndexedDBFactoryImpl | |
| 26 : NON_EXPORTED_BASE(public IndexedDBFactory) { | |
| 27 public: | |
| 28 static scoped_refptr<IndexedDBFactoryImpl> Create() { | |
| 29 return make_scoped_refptr(new IndexedDBFactoryImpl()); | |
| 30 } | |
| 31 | |
| 32 // Notifications from weak pointers. | |
| 33 virtual void RemoveIDBDatabaseBackend(const string16& unique_identifier); | |
| 34 | |
| 35 virtual void GetDatabaseNames( | |
| 36 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | |
| 37 const string16& database_identifier, | |
| 38 const base::FilePath& data_directory) OVERRIDE; | |
| 39 virtual void Open( | |
| 40 const string16& name, | |
| 41 int64 version, | |
| 42 int64 transaction_id, | |
| 43 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | |
| 44 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks, | |
| 45 const string16& database_identifier, | |
| 46 const base::FilePath& data_directory) OVERRIDE; | |
| 47 | |
| 48 virtual void DeleteDatabase( | |
| 49 const string16& name, | |
| 50 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | |
| 51 const string16& database_identifier, | |
| 52 const base::FilePath& data_directory) OVERRIDE; | |
| 53 | |
| 54 protected: | |
| 55 IndexedDBFactoryImpl(); | |
| 56 virtual ~IndexedDBFactoryImpl(); | |
| 57 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( | |
| 58 const string16& database_identifier, | |
| 59 const base::FilePath& data_directory); | |
| 60 | |
| 61 private: | |
| 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 |