Index: content/browser/indexed_db/indexed_db_factory_impl.h |
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.h b/content/browser/indexed_db/indexed_db_factory_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..72f1436d8cd76fd5d612d5ddeb604d01734faa2f |
--- /dev/null |
+++ b/content/browser/indexed_db/indexed_db_factory_impl.h |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
+#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |
+ |
+#include <map> |
+#include <set> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" |
+#include "content/browser/indexed_db/indexed_db_database_callbacks_wrapper.h" |
+#include "content/browser/indexed_db/indexed_db_factory.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+class DOMStringList; |
+ |
+class IndexedDBBackingStore; |
+class IndexedDBDatabaseImpl; |
+ |
+class CONTENT_EXPORT IndexedDBFactoryImpl : public IndexedDBFactory { |
+ public: |
+ static scoped_refptr<IndexedDBFactoryImpl> Create() { |
+ return make_scoped_refptr(new IndexedDBFactoryImpl()); |
+ } |
+ |
+ // Notifications from weak pointers. |
+ virtual void RemoveIDBDatabaseBackend(const string16& unique_identifier); |
+ |
+ virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacksWrapper>, |
+ const string16& database_identifier, |
+ const string16& data_dir) OVERRIDE; |
+ virtual void Open(const string16& name, |
+ int64_t version, |
+ int64_t transaction_id, |
+ scoped_refptr<IndexedDBCallbacksWrapper>, |
+ scoped_refptr<IndexedDBDatabaseCallbacksWrapper>, |
+ const string16& database_identifier, |
+ const string16& data_dir) OVERRIDE; |
+ |
+ virtual void DeleteDatabase(const string16& name, |
+ scoped_refptr<IndexedDBCallbacksWrapper>, |
+ const string16& database_identifier, |
+ const string16& data_dir) OVERRIDE; |
+ |
+ protected: |
+ IndexedDBFactoryImpl(); |
+ virtual ~IndexedDBFactoryImpl(); |
+ virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( |
+ const string16& database_identifier, |
+ const string16& data_dir); |
+ |
+ private: |
+ typedef std::map<string16, scoped_refptr<IndexedDBDatabaseImpl> > |
+ IndexedDBDatabaseMap; |
+ IndexedDBDatabaseMap database_backend_map_; |
+ |
+ typedef std::map<string16, base::WeakPtr<IndexedDBBackingStore> > |
+ IndexedDBBackingStoreMap; |
+ IndexedDBBackingStoreMap backing_store_map_; |
+ |
+ std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; |
+ |
+ // Only one instance of the factory should exist at any given time. |
+ static IndexedDBFactoryImpl* idb_factory_backend_impl; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_ |