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

Side by Side Diff: content/browser/indexed_db/indexed_db_factory.h

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "content/browser/indexed_db/indexed_db_callbacks.h" 20 #include "content/browser/indexed_db/indexed_db_change_handler.h"
21 #include "content/browser/indexed_db/indexed_db_database.h" 21 #include "content/browser/indexed_db/indexed_db_database.h"
22 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
23 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
24 #include "url/gurl.h" 23 #include "url/gurl.h"
25 #include "url/origin.h" 24 #include "url/origin.h"
26 25
27 namespace net { 26 namespace net {
28 class URLRequestContextGetter; 27 class URLRequestContextGetter;
29 } 28 }
30 29
31 namespace content { 30 namespace content {
32 31
33 class IndexedDBBackingStore; 32 class IndexedDBBackingStore;
34 struct IndexedDBPendingConnection; 33 class IndexedDBPendingConnection;
34 class IndexedDBPendingDelete;
35 struct IndexedDBDataLossInfo; 35 struct IndexedDBDataLossInfo;
36 36
37 class CONTENT_EXPORT IndexedDBFactory 37 class CONTENT_EXPORT IndexedDBFactory
38 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { 38 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) {
39 public: 39 public:
40 typedef std::multimap<url::Origin, IndexedDBDatabase*> OriginDBMap; 40 typedef std::multimap<url::Origin, IndexedDBDatabase*> OriginDBMap;
41 typedef OriginDBMap::const_iterator OriginDBMapIterator; 41 typedef OriginDBMap::const_iterator OriginDBMapIterator;
42 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; 42 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs;
43 43
44 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, 44 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier,
45 bool forced_close) = 0; 45 bool forced_close) = 0;
46 46
47 virtual void GetDatabaseNames( 47 virtual void GetDatabaseNames(
48 scoped_refptr<IndexedDBCallbacks> callbacks,
49 const url::Origin& origin, 48 const url::Origin& origin,
50 const base::FilePath& data_directory, 49 const base::FilePath& data_directory,
51 scoped_refptr<net::URLRequestContextGetter> request_context_getter) = 0; 50 scoped_refptr<net::URLRequestContextGetter> request_context_getter) = 0;
51 // TODO(cmumford): IndexedDBPendingConnection has the origin now (delete it).
52 virtual void Open( 52 virtual void Open(
53 const base::string16& name, 53 const base::string16& name,
54 std::unique_ptr<IndexedDBPendingConnection> connection, 54 std::unique_ptr<IndexedDBPendingConnection> connection,
55 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 55 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
56 const url::Origin& origin, 56 const url::Origin& origin,
57 const base::FilePath& data_directory) = 0; 57 const base::FilePath& data_directory) = 0;
58 58
59 virtual void DeleteDatabase( 59 virtual void DeleteDatabase(
60 const base::string16& name, 60 const base::string16& name,
61 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
62 scoped_refptr<IndexedDBCallbacks> callbacks, 62 std::unique_ptr<IndexedDBPendingDelete> pending_delete,
63 const url::Origin& origin, 63 const url::Origin& origin,
64 const base::FilePath& data_directory) = 0; 64 const base::FilePath& data_directory) = 0;
65 65
66 virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0; 66 virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0;
67 virtual void HandleBackingStoreCorruption( 67 virtual void HandleBackingStoreCorruption(
68 const url::Origin& origin, 68 const url::Origin& origin,
69 const IndexedDBDatabaseError& error) = 0; 69 const IndexedDBDatabaseError& error) = 0;
70 70
71 virtual OriginDBs GetOpenDatabasesForOrigin( 71 virtual OriginDBs GetOpenDatabasesForOrigin(
72 const url::Origin& origin) const = 0; 72 const url::Origin& origin) const = 0;
73 73
74 virtual void ForceClose(const url::Origin& origin) = 0; 74 virtual void ForceClose(const url::Origin& origin) = 0;
75 75
76 // Called by the IndexedDBContext destructor so the factory can do cleanup. 76 // Called by the IndexedDBContext destructor so the factory can do cleanup.
77 virtual void ContextDestroyed() = 0; 77 virtual void ContextDestroyed() = 0;
78 78
79 // Called by the IndexedDBActiveBlobRegistry. 79 // Called by the IndexedDBActiveBlobRegistry.
80 virtual void ReportOutstandingBlobs(const url::Origin& origin, 80 virtual void ReportOutstandingBlobs(const url::Origin& origin,
81 bool blobs_outstanding) = 0; 81 bool blobs_outstanding) = 0;
82 82
83 // Called by an IndexedDBDatabase when it is actually deleted. 83 // Called by an IndexedDBDatabase when it is actually deleted.
84 virtual void DatabaseDeleted( 84 virtual void DatabaseDeleted(
85 const IndexedDBDatabase::Identifier& identifier) = 0; 85 const IndexedDBDatabase::Identifier& identifier) = 0;
86 86
87 virtual size_t GetConnectionCount(const url::Origin& origin) const = 0; 87 virtual size_t GetConnectionCount(const url::Origin& origin) const = 0;
88 88
89 virtual IndexedDBContext* context() const = 0;
90
89 protected: 91 protected:
90 friend class base::RefCountedThreadSafe<IndexedDBFactory>; 92 friend class base::RefCountedThreadSafe<IndexedDBFactory>;
91 93
92 IndexedDBFactory() {} 94 IndexedDBFactory() {}
93 virtual ~IndexedDBFactory() {} 95 virtual ~IndexedDBFactory() {}
94 96
95 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( 97 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
96 const url::Origin& origin, 98 const url::Origin& origin,
97 const base::FilePath& data_directory, 99 const base::FilePath& data_directory,
98 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 100 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
(...skipping 10 matching lines...) Expand all
109 bool first_time, 111 bool first_time,
110 leveldb::Status* status) = 0; 112 leveldb::Status* status) = 0;
111 113
112 private: 114 private:
113 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); 115 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory);
114 }; 116 };
115 117
116 } // namespace content 118 } // namespace content
117 119
118 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 120 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.cc ('k') | content/browser/indexed_db/indexed_db_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698