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

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

Issue 18241003: IndexedDB: Remove IndexedDBCallbacksWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "content/browser/indexed_db/indexed_db.h" 14 #include "content/browser/indexed_db/indexed_db.h"
15 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" 15 #include "content/browser/indexed_db/indexed_db_callbacks.h"
16 #include "content/browser/indexed_db/indexed_db_metadata.h" 16 #include "content/browser/indexed_db/indexed_db_metadata.h"
17 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" 17 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
18 #include "content/browser/indexed_db/list_set.h" 18 #include "content/browser/indexed_db/list_set.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 class IndexedDBCallbacksWrapper; 22 class IndexedDBCallbacks;
23 class IndexedDBDatabaseCallbacks; 23 class IndexedDBDatabaseCallbacks;
24 class IndexedDBBackingStore; 24 class IndexedDBBackingStore;
25 class IndexedDBFactory; 25 class IndexedDBFactory;
26 class IndexedDBKey; 26 class IndexedDBKey;
27 class IndexedDBKeyPath; 27 class IndexedDBKeyPath;
28 class IndexedDBKeyRange; 28 class IndexedDBKeyRange;
29 class IndexedDBTransaction; 29 class IndexedDBTransaction;
30 30
31 class CONTENT_EXPORT IndexedDBDatabase 31 class CONTENT_EXPORT IndexedDBDatabase
32 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { 32 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) {
(...skipping 24 matching lines...) Expand all
57 int64 id() const { return metadata_.id; } 57 int64 id() const { return metadata_.id; }
58 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata, 58 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata,
59 int64 new_max_object_store_id); 59 int64 new_max_object_store_id);
60 void RemoveObjectStore(int64 object_store_id); 60 void RemoveObjectStore(int64 object_store_id);
61 void AddIndex(int64 object_store_id, 61 void AddIndex(int64 object_store_id,
62 const IndexedDBIndexMetadata& metadata, 62 const IndexedDBIndexMetadata& metadata,
63 int64 new_max_index_id); 63 int64 new_max_index_id);
64 void RemoveIndex(int64 object_store_id, int64 index_id); 64 void RemoveIndex(int64 object_store_id, int64 index_id);
65 65
66 void OpenConnection( 66 void OpenConnection(
67 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 67 scoped_refptr<IndexedDBCallbacks> callbacks,
68 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 68 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
69 int64 transaction_id, 69 int64 transaction_id,
70 int64 version); 70 int64 version);
71 void OpenConnection( 71 void OpenConnection(
72 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 72 scoped_refptr<IndexedDBCallbacks> callbacks,
73 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 73 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
74 int64 transaction_id, 74 int64 transaction_id,
75 int64 version, 75 int64 version,
76 WebKit::WebIDBCallbacks::DataLoss data_loss); 76 WebKit::WebIDBCallbacks::DataLoss data_loss);
77 void DeleteDatabase(scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 77 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks);
78 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } 78 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; }
79 79
80 void CreateObjectStore(int64 transaction_id, 80 void CreateObjectStore(int64 transaction_id,
81 int64 object_store_id, 81 int64 object_store_id,
82 const string16& name, 82 const string16& name,
83 const IndexedDBKeyPath& key_path, 83 const IndexedDBKeyPath& key_path,
84 bool auto_increment); 84 bool auto_increment);
85 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); 85 void DeleteObjectStore(int64 transaction_id, int64 object_store_id);
86 void CreateTransaction( 86 void CreateTransaction(int64 transaction_id,
87 int64 transaction_id, 87 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks,
88 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, 88 const std::vector<int64>& object_store_ids,
89 const std::vector<int64>& object_store_ids, 89 uint16 mode);
90 uint16 mode);
91 void Close(scoped_refptr<IndexedDBDatabaseCallbacks> callbacks); 90 void Close(scoped_refptr<IndexedDBDatabaseCallbacks> callbacks);
92 91
93 void Commit(int64 transaction_id); 92 void Commit(int64 transaction_id);
94 void Abort(int64 transaction_id); 93 void Abort(int64 transaction_id);
95 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); 94 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error);
96 95
97 void CreateIndex(int64 transaction_id, 96 void CreateIndex(int64 transaction_id,
98 int64 object_store_id, 97 int64 object_store_id,
99 int64 index_id, 98 int64 index_id,
100 const string16& name, 99 const string16& name,
101 const IndexedDBKeyPath& key_path, 100 const IndexedDBKeyPath& key_path,
102 bool unique, 101 bool unique,
103 bool multi_entry); 102 bool multi_entry);
104 void DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id); 103 void DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id);
105 104
106 IndexedDBTransactionCoordinator& transaction_coordinator() { 105 IndexedDBTransactionCoordinator& transaction_coordinator() {
107 return transaction_coordinator_; 106 return transaction_coordinator_;
108 } 107 }
109 108
110 void TransactionStarted(IndexedDBTransaction* transaction); 109 void TransactionStarted(IndexedDBTransaction* transaction);
111 void TransactionFinished(IndexedDBTransaction* transaction); 110 void TransactionFinished(IndexedDBTransaction* transaction);
112 void TransactionFinishedAndCompleteFired(IndexedDBTransaction* transaction); 111 void TransactionFinishedAndCompleteFired(IndexedDBTransaction* transaction);
113 void TransactionFinishedAndAbortFired(IndexedDBTransaction* transaction); 112 void TransactionFinishedAndAbortFired(IndexedDBTransaction* transaction);
114 113
115 void Get(int64 transaction_id, 114 void Get(int64 transaction_id,
116 int64 object_store_id, 115 int64 object_store_id,
117 int64 index_id, 116 int64 index_id,
118 scoped_ptr<IndexedDBKeyRange> key_range, 117 scoped_ptr<IndexedDBKeyRange> key_range,
119 bool key_only, 118 bool key_only,
120 scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 119 scoped_refptr<IndexedDBCallbacks> callbacks);
121 void Put(int64 transaction_id, 120 void Put(int64 transaction_id,
122 int64 object_store_id, 121 int64 object_store_id,
123 std::vector<char>* value, 122 std::vector<char>* value,
124 scoped_ptr<IndexedDBKey> key, 123 scoped_ptr<IndexedDBKey> key,
125 PutMode mode, 124 PutMode mode,
126 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 125 scoped_refptr<IndexedDBCallbacks> callbacks,
127 const std::vector<int64>& index_ids, 126 const std::vector<int64>& index_ids,
128 const std::vector<IndexKeys>& index_keys); 127 const std::vector<IndexKeys>& index_keys);
129 void SetIndexKeys(int64 transaction_id, 128 void SetIndexKeys(int64 transaction_id,
130 int64 object_store_id, 129 int64 object_store_id,
131 scoped_ptr<IndexedDBKey> primary_key, 130 scoped_ptr<IndexedDBKey> primary_key,
132 const std::vector<int64>& index_ids, 131 const std::vector<int64>& index_ids,
133 const std::vector<IndexKeys>& index_keys); 132 const std::vector<IndexKeys>& index_keys);
134 void SetIndexesReady(int64 transaction_id, 133 void SetIndexesReady(int64 transaction_id,
135 int64 object_store_id, 134 int64 object_store_id,
136 const std::vector<int64>& index_ids); 135 const std::vector<int64>& index_ids);
137 void OpenCursor(int64 transaction_id, 136 void OpenCursor(int64 transaction_id,
138 int64 object_store_id, 137 int64 object_store_id,
139 int64 index_id, 138 int64 index_id,
140 scoped_ptr<IndexedDBKeyRange> key_range, 139 scoped_ptr<IndexedDBKeyRange> key_range,
141 indexed_db::CursorDirection, 140 indexed_db::CursorDirection,
142 bool key_only, 141 bool key_only,
143 TaskType task_type, 142 TaskType task_type,
144 scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 143 scoped_refptr<IndexedDBCallbacks> callbacks);
145 void Count(int64 transaction_id, 144 void Count(int64 transaction_id,
146 int64 object_store_id, 145 int64 object_store_id,
147 int64 index_id, 146 int64 index_id,
148 scoped_ptr<IndexedDBKeyRange> key_range, 147 scoped_ptr<IndexedDBKeyRange> key_range,
149 scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 148 scoped_refptr<IndexedDBCallbacks> callbacks);
150 void DeleteRange(int64 transaction_id, 149 void DeleteRange(int64 transaction_id,
151 int64 object_store_id, 150 int64 object_store_id,
152 scoped_ptr<IndexedDBKeyRange> key_range, 151 scoped_ptr<IndexedDBKeyRange> key_range,
153 scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 152 scoped_refptr<IndexedDBCallbacks> callbacks);
154 void Clear(int64 transaction_id, 153 void Clear(int64 transaction_id,
155 int64 object_store_id, 154 int64 object_store_id,
156 scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 155 scoped_refptr<IndexedDBCallbacks> callbacks);
157 156
158 private: 157 private:
159 friend class base::RefCounted<IndexedDBDatabase>; 158 friend class base::RefCounted<IndexedDBDatabase>;
160 159
161 IndexedDBDatabase(const string16& name, 160 IndexedDBDatabase(const string16& name,
162 IndexedDBBackingStore* database, 161 IndexedDBBackingStore* database,
163 IndexedDBFactory* factory, 162 IndexedDBFactory* factory,
164 const string16& unique_identifier); 163 const string16& unique_identifier);
165 ~IndexedDBDatabase(); 164 ~IndexedDBDatabase();
166 165
167 bool IsOpenConnectionBlocked() const; 166 bool IsOpenConnectionBlocked() const;
168 bool OpenInternal(); 167 bool OpenInternal();
169 void RunVersionChangeTransaction( 168 void RunVersionChangeTransaction(
170 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 169 scoped_refptr<IndexedDBCallbacks> callbacks,
171 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 170 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
172 int64 transaction_id, 171 int64 transaction_id,
173 int64 requested_version, 172 int64 requested_version,
174 WebKit::WebIDBCallbacks::DataLoss data_loss); 173 WebKit::WebIDBCallbacks::DataLoss data_loss);
175 void RunVersionChangeTransactionFinal( 174 void RunVersionChangeTransactionFinal(
176 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 175 scoped_refptr<IndexedDBCallbacks> callbacks,
177 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 176 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
178 int64 transaction_id, 177 int64 transaction_id,
179 int64 requested_version); 178 int64 requested_version);
180 void RunVersionChangeTransactionFinal( 179 void RunVersionChangeTransactionFinal(
181 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, 180 scoped_refptr<IndexedDBCallbacks> callbacks,
182 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 181 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
183 int64 transaction_id, 182 int64 transaction_id,
184 int64 requested_version, 183 int64 requested_version,
185 WebKit::WebIDBCallbacks::DataLoss data_loss); 184 WebKit::WebIDBCallbacks::DataLoss data_loss);
186 size_t ConnectionCount() const; 185 size_t ConnectionCount() const;
187 void ProcessPendingCalls(); 186 void ProcessPendingCalls();
188 187
189 bool IsDeleteDatabaseBlocked() const; 188 bool IsDeleteDatabaseBlocked() const;
190 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacksWrapper> callbacks); 189 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks);
191 190
192 class VersionChangeOperation; 191 class VersionChangeOperation;
193 192
194 // When a "versionchange" transaction aborts, these restore the back-end 193 // When a "versionchange" transaction aborts, these restore the back-end
195 // object hierarchy. 194 // object hierarchy.
196 class VersionChangeAbortOperation; 195 class VersionChangeAbortOperation;
197 196
198 scoped_refptr<IndexedDBBackingStore> backing_store_; 197 scoped_refptr<IndexedDBBackingStore> backing_store_;
199 IndexedDBDatabaseMetadata metadata_; 198 IndexedDBDatabaseMetadata metadata_;
200 199
(...skipping 21 matching lines...) Expand all
222 typedef list_set<scoped_refptr<IndexedDBDatabaseCallbacks> > 221 typedef list_set<scoped_refptr<IndexedDBDatabaseCallbacks> >
223 DatabaseCallbacksSet; 222 DatabaseCallbacksSet;
224 DatabaseCallbacksSet database_callbacks_set_; 223 DatabaseCallbacksSet database_callbacks_set_;
225 224
226 bool closing_connection_; 225 bool closing_connection_;
227 }; 226 };
228 227
229 } // namespace content 228 } // namespace content
230 229
231 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ 230 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698