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

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

Issue 313883003: Split IndexedDBFactory into virtual base + impl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved indexed_db_factory_impl.h and relocated IsBackingStoreOpen. Created 6 years, 5 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_impl.h
diff --git a/content/browser/indexed_db/indexed_db_factory.h b/content/browser/indexed_db/indexed_db_factory_impl.h
similarity index 50%
copy from content/browser/indexed_db/indexed_db_factory.h
copy to content/browser/indexed_db/indexed_db_factory_impl.h
index aebc7f2baf0ead95d259d1190c1ac2913476e09a..f5d5115332a6ebf1d4c274d7849c767644a49e8a 100644
--- a/content/browser/indexed_db/indexed_db_factory.h
+++ b/content/browser/indexed_db/indexed_db_factory_impl.h
@@ -1,87 +1,66 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright (c) 2014 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_H_
-#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
+#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 <string>
-#include <utility>
-
-#include "base/basictypes.h"
-#include "base/files/file_path.h"
-#include "base/memory/ref_counted.h"
-#include "base/strings/string16.h"
-#include "content/browser/indexed_db/indexed_db_callbacks.h"
-#include "content/browser/indexed_db/indexed_db_database.h"
-#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
-#include "content/common/content_export.h"
-#include "url/gurl.h"
-
-namespace net {
-class URLRequestContext;
-}
+#include "content/browser/indexed_db/indexed_db_factory.h"
namespace content {
-class IndexedDBBackingStore;
class IndexedDBContextImpl;
-struct IndexedDBPendingConnection;
-class CONTENT_EXPORT IndexedDBFactory
- : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) {
+class CONTENT_EXPORT IndexedDBFactoryImpl : public IndexedDBFactory {
public:
- typedef std::multimap<GURL, IndexedDBDatabase*> OriginDBMap;
- typedef OriginDBMap::const_iterator OriginDBMapIterator;
-
- explicit IndexedDBFactory(IndexedDBContextImpl* context);
-
- void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier,
- bool forcedClose);
-
- void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks,
- const GURL& origin_url,
- const base::FilePath& data_directory,
- net::URLRequestContext* request_context);
- void Open(const base::string16& name,
- const IndexedDBPendingConnection& connection,
- net::URLRequestContext* request_context,
- const GURL& origin_url,
- const base::FilePath& data_directory);
+ explicit IndexedDBFactoryImpl(IndexedDBContextImpl* context);
- void DeleteDatabase(const base::string16& name,
- net::URLRequestContext* request_context,
- scoped_refptr<IndexedDBCallbacks> callbacks,
- const GURL& origin_url,
- const base::FilePath& data_directory);
+ // content::IndexedDBFactory overrides:
+ virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier,
+ bool forcedClose) OVERRIDE;
- void HandleBackingStoreFailure(const GURL& origin_url);
- void HandleBackingStoreCorruption(const GURL& origin_url,
- const IndexedDBDatabaseError& error);
+ virtual void GetDatabaseNames(
+ scoped_refptr<IndexedDBCallbacks> callbacks,
+ const GURL& origin_url,
+ const base::FilePath& data_directory,
+ net::URLRequestContext* request_context) OVERRIDE;
+ virtual void Open(const base::string16& name,
+ const IndexedDBPendingConnection& connection,
+ net::URLRequestContext* request_context,
+ const GURL& origin_url,
+ const base::FilePath& data_directory) OVERRIDE;
+
+ virtual void DeleteDatabase(const base::string16& name,
+ net::URLRequestContext* request_context,
+ scoped_refptr<IndexedDBCallbacks> callbacks,
+ const GURL& origin_url,
+ const base::FilePath& data_directory) OVERRIDE;
+
+ virtual void HandleBackingStoreFailure(const GURL& origin_url) OVERRIDE;
+ virtual void HandleBackingStoreCorruption(
+ const GURL& origin_url,
+ const IndexedDBDatabaseError& error) OVERRIDE;
- std::pair<OriginDBMapIterator, OriginDBMapIterator> GetOpenDatabasesForOrigin(
- const GURL& origin_url) const;
+ virtual std::pair<OriginDBMapIterator, OriginDBMapIterator>
+ GetOpenDatabasesForOrigin(const GURL& origin_url) const OVERRIDE;
- void ForceClose(const GURL& origin_url);
+ virtual void ForceClose(const GURL& origin_url) OVERRIDE;
// Called by the IndexedDBContext destructor so the factory can do cleanup.
- void ContextDestroyed();
+ virtual void ContextDestroyed() OVERRIDE;
// Called by the IndexedDBActiveBlobRegistry.
virtual void ReportOutstandingBlobs(const GURL& origin_url,
- bool blobs_outstanding);
+ bool blobs_outstanding) OVERRIDE;
// Called by an IndexedDBDatabase when it is actually deleted.
- void DatabaseDeleted(const IndexedDBDatabase::Identifier& identifier);
+ virtual void DatabaseDeleted(
+ const IndexedDBDatabase::Identifier& identifier) OVERRIDE;
- size_t GetConnectionCount(const GURL& origin_url) const;
+ virtual size_t GetConnectionCount(const GURL& origin_url) const OVERRIDE;
protected:
- friend class base::RefCountedThreadSafe<IndexedDBFactory>;
-
- virtual ~IndexedDBFactory();
+ virtual ~IndexedDBFactoryImpl();
virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
const GURL& origin_url,
@@ -90,7 +69,7 @@ class CONTENT_EXPORT IndexedDBFactory
blink::WebIDBDataLoss* data_loss,
std::string* data_loss_reason,
bool* disk_full,
- leveldb::Status* status);
+ leveldb::Status* s) OVERRIDE;
virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper(
const GURL& origin_url,
@@ -100,7 +79,7 @@ class CONTENT_EXPORT IndexedDBFactory
std::string* data_loss_message,
bool* disk_full,
bool first_time,
- leveldb::Status* status);
+ leveldb::Status* s) OVERRIDE;
void ReleaseBackingStore(const GURL& origin_url, bool immediate);
void CloseBackingStore(const GURL& origin_url);
@@ -127,16 +106,15 @@ class CONTENT_EXPORT IndexedDBFactory
bool HasLastBackingStoreReference(const GURL& origin_url) const;
// Testing helpers, so unit tests don't need to grovel through internal state.
- bool IsDatabaseOpen(const GURL& origin_url,
- const base::string16& name) const;
+ bool IsDatabaseOpen(const GURL& origin_url, const base::string16& name) const;
bool IsBackingStoreOpen(const GURL& origin_url) const;
bool IsBackingStorePendingClose(const GURL& origin_url) const;
void RemoveDatabaseFromMaps(const IndexedDBDatabase::Identifier& identifier);
IndexedDBContextImpl* context_;
- typedef std::map<IndexedDBDatabase::Identifier,
- IndexedDBDatabase*> IndexedDBDatabaseMap;
+ typedef std::map<IndexedDBDatabase::Identifier, IndexedDBDatabase*>
+ IndexedDBDatabaseMap;
IndexedDBDatabaseMap database_map_;
OriginDBMap origin_dbs_;
@@ -148,9 +126,9 @@ class CONTENT_EXPORT IndexedDBFactory
IndexedDBBackingStoreMap backing_stores_with_active_blobs_;
std::set<GURL> backends_opened_since_boot_;
- DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory);
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryImpl);
};
} // namespace content
-#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
+#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_IMPL_H_
« no previous file with comments | « content/browser/indexed_db/indexed_db_factory.cc ('k') | content/browser/indexed_db/indexed_db_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698