Chromium Code Reviews| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "content/browser/indexed_db/indexed_db.h" | 16 #include "content/browser/indexed_db/indexed_db.h" |
| 17 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 17 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 18 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 18 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 19 #include "content/browser/indexed_db/indexed_db_metadata.h" | 19 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 20 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | |
| 20 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 21 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 21 #include "content/browser/indexed_db/list_set.h" | 22 #include "content/browser/indexed_db/list_set.h" |
| 22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 class IndexedDBConnection; | 27 class IndexedDBConnection; |
| 27 class IndexedDBDatabaseCallbacks; | 28 class IndexedDBDatabaseCallbacks; |
| 28 class IndexedDBFactory; | 29 class IndexedDBFactory; |
| 29 class IndexedDBKey; | 30 class IndexedDBKey; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 const base::string16& name() const { return metadata_.name; } | 68 const base::string16& name() const { return metadata_.name; } |
| 68 | 69 |
| 69 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata, | 70 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata, |
| 70 int64 new_max_object_store_id); | 71 int64 new_max_object_store_id); |
| 71 void RemoveObjectStore(int64 object_store_id); | 72 void RemoveObjectStore(int64 object_store_id); |
| 72 void AddIndex(int64 object_store_id, | 73 void AddIndex(int64 object_store_id, |
| 73 const IndexedDBIndexMetadata& metadata, | 74 const IndexedDBIndexMetadata& metadata, |
| 74 int64 new_max_index_id); | 75 int64 new_max_index_id); |
| 75 void RemoveIndex(int64 object_store_id, int64 index_id); | 76 void RemoveIndex(int64 object_store_id, int64 index_id); |
| 76 | 77 |
| 77 void OpenConnection( | 78 void OpenConnection(const IndexedDBPendingConnection& connection); |
| 78 scoped_refptr<IndexedDBCallbacks> callbacks, | |
| 79 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | |
| 80 int64 transaction_id, | |
| 81 int64 version); | |
| 82 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); | 79 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 83 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } | 80 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } |
| 84 | 81 |
| 85 void CreateObjectStore(int64 transaction_id, | 82 void CreateObjectStore(int64 transaction_id, |
| 86 int64 object_store_id, | 83 int64 object_store_id, |
| 87 const base::string16& name, | 84 const base::string16& name, |
| 88 const IndexedDBKeyPath& key_path, | 85 const IndexedDBKeyPath& key_path, |
| 89 bool auto_increment); | 86 bool auto_increment); |
| 90 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); | 87 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); |
| 91 void CreateTransaction(int64 transaction_id, | 88 void CreateTransaction(int64 transaction_id, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 void RunVersionChangeTransactionFinal( | 246 void RunVersionChangeTransactionFinal( |
| 250 scoped_refptr<IndexedDBCallbacks> callbacks, | 247 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 251 scoped_ptr<IndexedDBConnection> connection, | 248 scoped_ptr<IndexedDBConnection> connection, |
| 252 int64 transaction_id, | 249 int64 transaction_id, |
| 253 int64 requested_version); | 250 int64 requested_version); |
| 254 void ProcessPendingCalls(); | 251 void ProcessPendingCalls(); |
| 255 | 252 |
| 256 bool IsDeleteDatabaseBlocked() const; | 253 bool IsDeleteDatabaseBlocked() const; |
| 257 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); | 254 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 258 | 255 |
| 256 scoped_ptr<IndexedDBConnection> CreateConnection( | |
| 257 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | |
| 258 int child_process_id); | |
| 259 | |
| 259 IndexedDBTransaction* GetTransaction(int64 transaction_id) const; | 260 IndexedDBTransaction* GetTransaction(int64 transaction_id) const; |
| 260 | 261 |
| 261 bool ValidateObjectStoreId(int64 object_store_id) const; | 262 bool ValidateObjectStoreId(int64 object_store_id) const; |
| 262 bool ValidateObjectStoreIdAndIndexId(int64 object_store_id, | 263 bool ValidateObjectStoreIdAndIndexId(int64 object_store_id, |
| 263 int64 index_id) const; | 264 int64 index_id) const; |
| 264 bool ValidateObjectStoreIdAndOptionalIndexId(int64 object_store_id, | 265 bool ValidateObjectStoreIdAndOptionalIndexId(int64 object_store_id, |
| 265 int64 index_id) const; | 266 int64 index_id) const; |
| 266 bool ValidateObjectStoreIdAndNewIndexId(int64 object_store_id, | 267 bool ValidateObjectStoreIdAndNewIndexId(int64 object_store_id, |
| 267 int64 index_id) const; | 268 int64 index_id) const; |
| 268 | 269 |
| 269 scoped_refptr<IndexedDBBackingStore> backing_store_; | 270 scoped_refptr<IndexedDBBackingStore> backing_store_; |
| 270 IndexedDBDatabaseMetadata metadata_; | 271 IndexedDBDatabaseMetadata metadata_; |
| 271 | 272 |
| 272 const Identifier identifier_; | 273 const Identifier identifier_; |
| 273 // This might not need to be a scoped_refptr since the factory's lifetime is | 274 // This might not need to be a scoped_refptr since the factory's lifetime is |
| 274 // that of the page group, but it's better to be conservitive than sorry. | 275 // that of the page group, but it's better to be conservative than sorry. |
|
jsbell
2014/03/12 23:40:49
"page group" doesn't even make sense here (that's
ericu
2014/03/12 23:56:37
Well, is this necessary or not? Should this turn
ericu
2014/03/12 23:56:37
Done.
| |
| 275 scoped_refptr<IndexedDBFactory> factory_; | 276 scoped_refptr<IndexedDBFactory> factory_; |
| 276 | 277 |
| 277 IndexedDBTransactionCoordinator transaction_coordinator_; | 278 IndexedDBTransactionCoordinator transaction_coordinator_; |
| 278 | 279 |
| 279 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; | 280 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; |
| 280 TransactionMap transactions_; | 281 TransactionMap transactions_; |
| 281 | 282 |
| 282 class PendingOpenCall; | 283 typedef std::list<IndexedDBPendingConnection> PendingOpenCallList; |
| 283 typedef std::list<PendingOpenCall*> PendingOpenCallList; | |
| 284 PendingOpenCallList pending_open_calls_; | 284 PendingOpenCallList pending_open_calls_; |
| 285 | 285 |
| 286 class PendingUpgradeCall; | 286 class PendingUpgradeCall; |
| 287 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; | 287 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; |
| 288 class PendingSuccessCall; | 288 class PendingSuccessCall; |
| 289 scoped_ptr<PendingSuccessCall> pending_second_half_open_; | 289 scoped_ptr<PendingSuccessCall> pending_second_half_open_; |
| 290 | 290 |
| 291 class PendingDeleteCall; | 291 class PendingDeleteCall; |
| 292 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 292 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
| 293 PendingDeleteCallList pending_delete_calls_; | 293 PendingDeleteCallList pending_delete_calls_; |
| 294 | 294 |
| 295 typedef list_set<IndexedDBConnection*> ConnectionSet; | 295 typedef list_set<IndexedDBConnection*> ConnectionSet; |
| 296 ConnectionSet connections_; | 296 ConnectionSet connections_; |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 } // namespace content | 299 } // namespace content |
| 300 | 300 |
| 301 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 301 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |