| 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 <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "content/browser/indexed_db/indexed_db.h" | 15 #include "content/browser/indexed_db/indexed_db.h" |
| 16 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 16 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 17 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 17 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 18 #include "content/browser/indexed_db/indexed_db_metadata.h" | 18 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 19 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 19 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 20 #include "content/browser/indexed_db/list_set.h" | 20 #include "content/browser/indexed_db/list_set.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class IndexedDBBlobInfo; |
| 25 class IndexedDBConnection; | 26 class IndexedDBConnection; |
| 26 class IndexedDBDatabaseCallbacks; | 27 class IndexedDBDatabaseCallbacks; |
| 27 class IndexedDBFactory; | 28 class IndexedDBFactory; |
| 28 class IndexedDBKey; | 29 class IndexedDBKey; |
| 29 class IndexedDBKeyPath; | 30 class IndexedDBKeyPath; |
| 30 class IndexedDBKeyRange; | 31 class IndexedDBKeyRange; |
| 31 class IndexedDBTransaction; | 32 class IndexedDBTransaction; |
| 33 struct IndexedDBValue; |
| 32 | 34 |
| 33 class CONTENT_EXPORT IndexedDBDatabase | 35 class CONTENT_EXPORT IndexedDBDatabase |
| 34 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { | 36 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { |
| 35 public: | 37 public: |
| 36 enum TaskType { | 38 enum TaskType { |
| 37 NORMAL_TASK = 0, | 39 NORMAL_TASK = 0, |
| 38 PREEMPTIVE_TASK | 40 PREEMPTIVE_TASK |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 enum PutMode { | 43 enum PutMode { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 67 int64 new_max_object_store_id); | 69 int64 new_max_object_store_id); |
| 68 void RemoveObjectStore(int64 object_store_id); | 70 void RemoveObjectStore(int64 object_store_id); |
| 69 void AddIndex(int64 object_store_id, | 71 void AddIndex(int64 object_store_id, |
| 70 const IndexedDBIndexMetadata& metadata, | 72 const IndexedDBIndexMetadata& metadata, |
| 71 int64 new_max_index_id); | 73 int64 new_max_index_id); |
| 72 void RemoveIndex(int64 object_store_id, int64 index_id); | 74 void RemoveIndex(int64 object_store_id, int64 index_id); |
| 73 | 75 |
| 74 void OpenConnection( | 76 void OpenConnection( |
| 75 scoped_refptr<IndexedDBCallbacks> callbacks, | 77 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 76 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 78 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
| 79 int child_process_id, |
| 77 int64 transaction_id, | 80 int64 transaction_id, |
| 78 int64 version); | 81 int64 version); |
| 79 void OpenConnection( | 82 void OpenConnection( |
| 80 scoped_refptr<IndexedDBCallbacks> callbacks, | 83 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 81 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 84 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
| 85 int child_process_id, |
| 82 int64 transaction_id, | 86 int64 transaction_id, |
| 83 int64 version, | 87 int64 version, |
| 84 blink::WebIDBDataLoss data_loss, | 88 blink::WebIDBDataLoss data_loss, |
| 85 std::string data_loss_message); | 89 std::string data_loss_message); |
| 86 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); | 90 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 87 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } | 91 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } |
| 88 | 92 |
| 89 void CreateObjectStore(int64 transaction_id, | 93 void CreateObjectStore(int64 transaction_id, |
| 90 int64 object_store_id, | 94 int64 object_store_id, |
| 91 const string16& name, | 95 const string16& name, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void TransactionCommitFailed(); | 131 void TransactionCommitFailed(); |
| 128 | 132 |
| 129 void Get(int64 transaction_id, | 133 void Get(int64 transaction_id, |
| 130 int64 object_store_id, | 134 int64 object_store_id, |
| 131 int64 index_id, | 135 int64 index_id, |
| 132 scoped_ptr<IndexedDBKeyRange> key_range, | 136 scoped_ptr<IndexedDBKeyRange> key_range, |
| 133 bool key_only, | 137 bool key_only, |
| 134 scoped_refptr<IndexedDBCallbacks> callbacks); | 138 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 135 void Put(int64 transaction_id, | 139 void Put(int64 transaction_id, |
| 136 int64 object_store_id, | 140 int64 object_store_id, |
| 137 std::string* value, | 141 IndexedDBValue* value, |
| 142 ScopedVector<webkit_blob::BlobDataHandle>* handles, |
| 138 scoped_ptr<IndexedDBKey> key, | 143 scoped_ptr<IndexedDBKey> key, |
| 139 PutMode mode, | 144 PutMode mode, |
| 140 scoped_refptr<IndexedDBCallbacks> callbacks, | 145 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 141 const std::vector<int64>& index_ids, | 146 const std::vector<int64>& index_ids, |
| 142 const std::vector<IndexKeys>& index_keys); | 147 const std::vector<IndexKeys>& index_keys); |
| 143 void SetIndexKeys(int64 transaction_id, | 148 void SetIndexKeys(int64 transaction_id, |
| 144 int64 object_store_id, | 149 int64 object_store_id, |
| 145 scoped_ptr<IndexedDBKey> primary_key, | 150 scoped_ptr<IndexedDBKey> primary_key, |
| 146 const std::vector<int64>& index_ids, | 151 const std::vector<int64>& index_ids, |
| 147 const std::vector<IndexKeys>& index_keys); | 152 const std::vector<IndexKeys>& index_keys); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 bool ValidateObjectStoreIdAndOptionalIndexId(int64 object_store_id, | 287 bool ValidateObjectStoreIdAndOptionalIndexId(int64 object_store_id, |
| 283 int64 index_id) const; | 288 int64 index_id) const; |
| 284 bool ValidateObjectStoreIdAndNewIndexId(int64 object_store_id, | 289 bool ValidateObjectStoreIdAndNewIndexId(int64 object_store_id, |
| 285 int64 index_id) const; | 290 int64 index_id) const; |
| 286 | 291 |
| 287 scoped_refptr<IndexedDBBackingStore> backing_store_; | 292 scoped_refptr<IndexedDBBackingStore> backing_store_; |
| 288 IndexedDBDatabaseMetadata metadata_; | 293 IndexedDBDatabaseMetadata metadata_; |
| 289 | 294 |
| 290 const Identifier identifier_; | 295 const Identifier identifier_; |
| 291 // This might not need to be a scoped_refptr since the factory's lifetime is | 296 // This might not need to be a scoped_refptr since the factory's lifetime is |
| 292 // that of the page group, but it's better to be conservitive than sorry. | 297 // that of the page group, but it's better to be conservative than sorry. |
| 293 scoped_refptr<IndexedDBFactory> factory_; | 298 scoped_refptr<IndexedDBFactory> factory_; |
| 294 | 299 |
| 295 IndexedDBTransactionCoordinator transaction_coordinator_; | 300 IndexedDBTransactionCoordinator transaction_coordinator_; |
| 296 IndexedDBTransaction* running_version_change_transaction_; | 301 IndexedDBTransaction* running_version_change_transaction_; |
| 297 | 302 |
| 298 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; | 303 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; |
| 299 TransactionMap transactions_; | 304 TransactionMap transactions_; |
| 300 | 305 |
| 301 class PendingOpenCall; | 306 class PendingOpenCall; |
| 302 typedef std::list<PendingOpenCall*> PendingOpenCallList; | 307 typedef std::list<PendingOpenCall*> PendingOpenCallList; |
| 303 PendingOpenCallList pending_open_calls_; | 308 PendingOpenCallList pending_open_calls_; |
| 304 | 309 |
| 305 class PendingUpgradeCall; | 310 class PendingUpgradeCall; |
| 306 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; | 311 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; |
| 307 class PendingSuccessCall; | 312 class PendingSuccessCall; |
| 308 scoped_ptr<PendingSuccessCall> pending_second_half_open_; | 313 scoped_ptr<PendingSuccessCall> pending_second_half_open_; |
| 309 | 314 |
| 310 class PendingDeleteCall; | 315 class PendingDeleteCall; |
| 311 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 316 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
| 312 PendingDeleteCallList pending_delete_calls_; | 317 PendingDeleteCallList pending_delete_calls_; |
| 313 | 318 |
| 314 typedef list_set<IndexedDBConnection*> ConnectionSet; | 319 typedef list_set<IndexedDBConnection*> ConnectionSet; |
| 315 ConnectionSet connections_; | 320 ConnectionSet connections_; |
| 316 }; | 321 }; |
| 317 | 322 |
| 318 } // namespace content | 323 } // namespace content |
| 319 | 324 |
| 320 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 325 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |