Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1208)

Unified Diff: content/browser/indexed_db/indexed_db_factory.h

Issue 16581002: IndexedDB: Eliminate interfaces for IndexedDB{Factory,Database,Cursor} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_factory.h
diff --git a/content/browser/indexed_db/indexed_db_factory.h b/content/browser/indexed_db/indexed_db_factory.h
index 20f77a25d94a53af8224ba0509923b838e9ebcaf..6844571996e69183b6ead34880a05d87d403d4a1 100644
--- a/content/browser/indexed_db/indexed_db_factory.h
+++ b/content/browser/indexed_db/indexed_db_factory.h
@@ -5,42 +5,70 @@
#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
+#include <map>
+#include <set>
+
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/string16.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 IndexedDBCallbacksWrapper;
+class IndexedDBBackingStore;
class IndexedDBDatabase;
-class IndexedDBDatabaseCallbacksWrapper;
-class IndexedDBFactory : public base::RefCounted<IndexedDBFactory> {
+class CONTENT_EXPORT IndexedDBFactory
+ : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBFactory>) {
public:
- static scoped_refptr<IndexedDBFactory> Create();
+ static scoped_refptr<IndexedDBFactory> Create() {
+ return make_scoped_refptr(new IndexedDBFactory());
+ }
- virtual void GetDatabaseNames(
- scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
- const string16& database_identifier,
- const base::FilePath& data_directory) = 0;
- virtual void Open(
- const string16& name,
- int64 version,
- int64 transaction_id,
- scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
- scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks,
- const string16& database_identifier,
- const base::FilePath& data_directory) = 0;
- virtual void DeleteDatabase(
- const string16& name,
- scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
- const string16& database_identifier,
- const base::FilePath& data_directory) = 0;
+ // Notifications from weak pointers.
+ void RemoveIDBDatabaseBackend(const string16& unique_identifier);
+
+ void GetDatabaseNames(scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
+ const string16& database_identifier,
+ const base::FilePath& data_directory);
+ void Open(const string16& name,
+ int64 version,
+ int64 transaction_id,
+ scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
+ scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks,
+ const string16& database_identifier,
+ const base::FilePath& data_directory);
+
+ void DeleteDatabase(const string16& name,
+ scoped_refptr<IndexedDBCallbacksWrapper> callbacks,
+ const string16& database_identifier,
+ const base::FilePath& data_directory);
protected:
- virtual ~IndexedDBFactory() {}
friend class base::RefCounted<IndexedDBFactory>;
+
+ IndexedDBFactory();
+ virtual ~IndexedDBFactory();
+
+ scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
+ const string16& database_identifier,
+ const base::FilePath& data_directory);
+
+ private:
+ typedef std::map<string16, scoped_refptr<IndexedDBDatabase> >
+ 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_;
};
} // namespace content
« no previous file with comments | « content/browser/indexed_db/indexed_db_database_unittest.cc ('k') | content/browser/indexed_db/indexed_db_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698