OLD | NEW |
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_wrapper.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 IndexedDBCallbacksWrapper; |
23 class IndexedDBDatabaseCallbacksWrapper; | 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>) { |
33 public: | 33 public: |
(...skipping 24 matching lines...) Expand all Loading... |
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<IndexedDBCallbacksWrapper> callbacks, |
68 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> 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<IndexedDBCallbacksWrapper> callbacks, |
73 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> 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<IndexedDBCallbacksWrapper> 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( |
87 int64 transaction_id, | 87 int64 transaction_id, |
88 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks, | 88 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, |
89 const std::vector<int64>& object_store_ids, | 89 const std::vector<int64>& object_store_ids, |
90 uint16 mode); | 90 uint16 mode); |
91 void Close(scoped_refptr<IndexedDBDatabaseCallbacksWrapper> callbacks); | 91 void Close(scoped_refptr<IndexedDBDatabaseCallbacks> callbacks); |
92 | 92 |
93 void Commit(int64 transaction_id); | 93 void Commit(int64 transaction_id); |
94 void Abort(int64 transaction_id); | 94 void Abort(int64 transaction_id); |
95 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); | 95 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); |
96 | 96 |
97 void CreateIndex(int64 transaction_id, | 97 void CreateIndex(int64 transaction_id, |
98 int64 object_store_id, | 98 int64 object_store_id, |
99 int64 index_id, | 99 int64 index_id, |
100 const string16& name, | 100 const string16& name, |
101 const IndexedDBKeyPath& key_path, | 101 const IndexedDBKeyPath& key_path, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 IndexedDBDatabase(const string16& name, | 161 IndexedDBDatabase(const string16& name, |
162 IndexedDBBackingStore* database, | 162 IndexedDBBackingStore* database, |
163 IndexedDBFactory* factory, | 163 IndexedDBFactory* factory, |
164 const string16& unique_identifier); | 164 const string16& unique_identifier); |
165 ~IndexedDBDatabase(); | 165 ~IndexedDBDatabase(); |
166 | 166 |
167 bool IsOpenConnectionBlocked() const; | 167 bool IsOpenConnectionBlocked() const; |
168 bool OpenInternal(); | 168 bool OpenInternal(); |
169 void RunVersionChangeTransaction( | 169 void RunVersionChangeTransaction( |
170 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | 170 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, |
171 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks, | 171 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
172 int64 transaction_id, | 172 int64 transaction_id, |
173 int64 requested_version, | 173 int64 requested_version, |
174 WebKit::WebIDBCallbacks::DataLoss data_loss); | 174 WebKit::WebIDBCallbacks::DataLoss data_loss); |
175 void RunVersionChangeTransactionFinal( | 175 void RunVersionChangeTransactionFinal( |
176 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | 176 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, |
177 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks, | 177 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
178 int64 transaction_id, | 178 int64 transaction_id, |
179 int64 requested_version); | 179 int64 requested_version); |
180 void RunVersionChangeTransactionFinal( | 180 void RunVersionChangeTransactionFinal( |
181 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, | 181 scoped_refptr<IndexedDBCallbacksWrapper> callbacks, |
182 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks, | 182 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
183 int64 transaction_id, | 183 int64 transaction_id, |
184 int64 requested_version, | 184 int64 requested_version, |
185 WebKit::WebIDBCallbacks::DataLoss data_loss); | 185 WebKit::WebIDBCallbacks::DataLoss data_loss); |
186 size_t ConnectionCount() const; | 186 size_t ConnectionCount() const; |
187 void ProcessPendingCalls(); | 187 void ProcessPendingCalls(); |
188 | 188 |
189 bool IsDeleteDatabaseBlocked() const; | 189 bool IsDeleteDatabaseBlocked() const; |
190 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacksWrapper> callbacks); | 190 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacksWrapper> callbacks); |
191 | 191 |
192 class VersionChangeOperation; | 192 class VersionChangeOperation; |
(...skipping 19 matching lines...) Expand all Loading... |
212 class PendingOpenCall; | 212 class PendingOpenCall; |
213 typedef std::list<PendingOpenCall*> PendingOpenCallList; | 213 typedef std::list<PendingOpenCall*> PendingOpenCallList; |
214 PendingOpenCallList pending_open_calls_; | 214 PendingOpenCallList pending_open_calls_; |
215 scoped_ptr<PendingOpenCall> pending_run_version_change_transaction_call_; | 215 scoped_ptr<PendingOpenCall> pending_run_version_change_transaction_call_; |
216 scoped_ptr<PendingOpenCall> pending_second_half_open_; | 216 scoped_ptr<PendingOpenCall> pending_second_half_open_; |
217 | 217 |
218 class PendingDeleteCall; | 218 class PendingDeleteCall; |
219 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 219 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
220 PendingDeleteCallList pending_delete_calls_; | 220 PendingDeleteCallList pending_delete_calls_; |
221 | 221 |
222 typedef list_set<scoped_refptr<IndexedDBDatabaseCallbacksWrapper> > | 222 typedef list_set<scoped_refptr<IndexedDBDatabaseCallbacks> > |
223 DatabaseCallbacksSet; | 223 DatabaseCallbacksSet; |
224 DatabaseCallbacksSet database_callbacks_set_; | 224 DatabaseCallbacksSet database_callbacks_set_; |
225 | 225 |
226 bool closing_connection_; | 226 bool closing_connection_; |
227 }; | 227 }; |
228 | 228 |
229 } // namespace content | 229 } // namespace content |
230 | 230 |
231 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 231 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
OLD | NEW |