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 <string> | 10 #include <string> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 }; | 45 }; |
46 | 46 |
47 typedef std::vector<IndexedDBKey> IndexKeys; | 47 typedef std::vector<IndexedDBKey> IndexKeys; |
48 // Identifier is pair of (origin url, database name). | 48 // Identifier is pair of (origin url, database name). |
49 typedef std::pair<GURL, base::string16> Identifier; | 49 typedef std::pair<GURL, base::string16> Identifier; |
50 | 50 |
51 static const int64 kInvalidId = 0; | 51 static const int64 kInvalidId = 0; |
52 static const int64 kMinimumIndexId = 30; | 52 static const int64 kMinimumIndexId = 30; |
53 | 53 |
54 static scoped_refptr<IndexedDBDatabase> Create( | 54 static scoped_refptr<IndexedDBDatabase> Create( |
55 const string16& name, | 55 const base::string16& name, |
56 IndexedDBBackingStore* backing_store, | 56 IndexedDBBackingStore* backing_store, |
57 IndexedDBFactory* factory, | 57 IndexedDBFactory* factory, |
58 const Identifier& unique_identifier); | 58 const Identifier& unique_identifier); |
59 | 59 |
60 const Identifier& identifier() const { return identifier_; } | 60 const Identifier& identifier() const { return identifier_; } |
61 IndexedDBBackingStore* backing_store() { return backing_store_.get(); } | 61 IndexedDBBackingStore* backing_store() { return backing_store_.get(); } |
62 | 62 |
63 int64 id() const { return metadata_.id; } | 63 int64 id() const { return metadata_.id; } |
64 const base::string16& name() const { return metadata_.name; } | 64 const base::string16& name() const { return metadata_.name; } |
65 | 65 |
(...skipping 15 matching lines...) Expand all Loading... |
81 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 81 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
82 int64 transaction_id, | 82 int64 transaction_id, |
83 int64 version, | 83 int64 version, |
84 blink::WebIDBDataLoss data_loss, | 84 blink::WebIDBDataLoss data_loss, |
85 std::string data_loss_message); | 85 std::string data_loss_message); |
86 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); | 86 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); |
87 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } | 87 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } |
88 | 88 |
89 void CreateObjectStore(int64 transaction_id, | 89 void CreateObjectStore(int64 transaction_id, |
90 int64 object_store_id, | 90 int64 object_store_id, |
91 const string16& name, | 91 const base::string16& name, |
92 const IndexedDBKeyPath& key_path, | 92 const IndexedDBKeyPath& key_path, |
93 bool auto_increment); | 93 bool auto_increment); |
94 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); | 94 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); |
95 void CreateTransaction(int64 transaction_id, | 95 void CreateTransaction(int64 transaction_id, |
96 IndexedDBConnection* connection, | 96 IndexedDBConnection* connection, |
97 const std::vector<int64>& object_store_ids, | 97 const std::vector<int64>& object_store_ids, |
98 uint16 mode); | 98 uint16 mode); |
99 void Close(IndexedDBConnection* connection, bool forced); | 99 void Close(IndexedDBConnection* connection, bool forced); |
100 | 100 |
101 void Commit(int64 transaction_id); | 101 void Commit(int64 transaction_id); |
102 void Abort(int64 transaction_id); | 102 void Abort(int64 transaction_id); |
103 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); | 103 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); |
104 | 104 |
105 void CreateIndex(int64 transaction_id, | 105 void CreateIndex(int64 transaction_id, |
106 int64 object_store_id, | 106 int64 object_store_id, |
107 int64 index_id, | 107 int64 index_id, |
108 const string16& name, | 108 const base::string16& name, |
109 const IndexedDBKeyPath& key_path, | 109 const IndexedDBKeyPath& key_path, |
110 bool unique, | 110 bool unique, |
111 bool multi_entry); | 111 bool multi_entry); |
112 void DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id); | 112 void DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id); |
113 | 113 |
114 IndexedDBTransactionCoordinator& transaction_coordinator() { | 114 IndexedDBTransactionCoordinator& transaction_coordinator() { |
115 return transaction_coordinator_; | 115 return transaction_coordinator_; |
116 } | 116 } |
117 const IndexedDBTransactionCoordinator& transaction_coordinator() const { | 117 const IndexedDBTransactionCoordinator& transaction_coordinator() const { |
118 return transaction_coordinator_; | 118 return transaction_coordinator_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 IndexedDBTransaction* transaction); | 191 IndexedDBTransaction* transaction); |
192 void DeleteObjectStoreAbortOperation( | 192 void DeleteObjectStoreAbortOperation( |
193 const IndexedDBObjectStoreMetadata& object_store_metadata, | 193 const IndexedDBObjectStoreMetadata& object_store_metadata, |
194 IndexedDBTransaction* transaction); | 194 IndexedDBTransaction* transaction); |
195 void VersionChangeOperation(int64 version, | 195 void VersionChangeOperation(int64 version, |
196 scoped_refptr<IndexedDBCallbacks> callbacks, | 196 scoped_refptr<IndexedDBCallbacks> callbacks, |
197 scoped_ptr<IndexedDBConnection> connection, | 197 scoped_ptr<IndexedDBConnection> connection, |
198 blink::WebIDBDataLoss data_loss, | 198 blink::WebIDBDataLoss data_loss, |
199 std::string data_loss_message, | 199 std::string data_loss_message, |
200 IndexedDBTransaction* transaction); | 200 IndexedDBTransaction* transaction); |
201 void VersionChangeAbortOperation(const string16& previous_version, | 201 void VersionChangeAbortOperation(const base::string16& previous_version, |
202 int64 previous_int_version, | 202 int64 previous_int_version, |
203 IndexedDBTransaction* transaction); | 203 IndexedDBTransaction* transaction); |
204 void CreateIndexOperation(int64 object_store_id, | 204 void CreateIndexOperation(int64 object_store_id, |
205 const IndexedDBIndexMetadata& index_metadata, | 205 const IndexedDBIndexMetadata& index_metadata, |
206 IndexedDBTransaction* transaction); | 206 IndexedDBTransaction* transaction); |
207 void DeleteIndexOperation(int64 object_store_id, | 207 void DeleteIndexOperation(int64 object_store_id, |
208 const IndexedDBIndexMetadata& index_metadata, | 208 const IndexedDBIndexMetadata& index_metadata, |
209 IndexedDBTransaction* transaction); | 209 IndexedDBTransaction* transaction); |
210 void CreateIndexAbortOperation(int64 object_store_id, | 210 void CreateIndexAbortOperation(int64 object_store_id, |
211 int64 index_id, | 211 int64 index_id, |
(...skipping 24 matching lines...) Expand all Loading... |
236 scoped_ptr<IndexedDBKeyRange> key_range, | 236 scoped_ptr<IndexedDBKeyRange> key_range, |
237 scoped_refptr<IndexedDBCallbacks> callbacks, | 237 scoped_refptr<IndexedDBCallbacks> callbacks, |
238 IndexedDBTransaction* transaction); | 238 IndexedDBTransaction* transaction); |
239 void ClearOperation(int64 object_store_id, | 239 void ClearOperation(int64 object_store_id, |
240 scoped_refptr<IndexedDBCallbacks> callbacks, | 240 scoped_refptr<IndexedDBCallbacks> callbacks, |
241 IndexedDBTransaction* transaction); | 241 IndexedDBTransaction* transaction); |
242 | 242 |
243 private: | 243 private: |
244 friend class base::RefCounted<IndexedDBDatabase>; | 244 friend class base::RefCounted<IndexedDBDatabase>; |
245 | 245 |
246 IndexedDBDatabase(const string16& name, | 246 IndexedDBDatabase(const base::string16& name, |
247 IndexedDBBackingStore* backing_store, | 247 IndexedDBBackingStore* backing_store, |
248 IndexedDBFactory* factory, | 248 IndexedDBFactory* factory, |
249 const Identifier& unique_identifier); | 249 const Identifier& unique_identifier); |
250 ~IndexedDBDatabase(); | 250 ~IndexedDBDatabase(); |
251 | 251 |
252 bool IsOpenConnectionBlocked() const; | 252 bool IsOpenConnectionBlocked() const; |
253 bool OpenInternal(); | 253 bool OpenInternal(); |
254 void RunVersionChangeTransaction(scoped_refptr<IndexedDBCallbacks> callbacks, | 254 void RunVersionChangeTransaction(scoped_refptr<IndexedDBCallbacks> callbacks, |
255 scoped_ptr<IndexedDBConnection> connection, | 255 scoped_ptr<IndexedDBConnection> connection, |
256 int64 transaction_id, | 256 int64 transaction_id, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 311 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
312 PendingDeleteCallList pending_delete_calls_; | 312 PendingDeleteCallList pending_delete_calls_; |
313 | 313 |
314 typedef list_set<IndexedDBConnection*> ConnectionSet; | 314 typedef list_set<IndexedDBConnection*> ConnectionSet; |
315 ConnectionSet connections_; | 315 ConnectionSet connections_; |
316 }; | 316 }; |
317 | 317 |
318 } // namespace content | 318 } // namespace content |
319 | 319 |
320 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 320 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
OLD | NEW |