| 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.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 IndexedDBConnection; |
| 22 class IndexedDBDatabaseCallbacks; | 23 class IndexedDBDatabaseCallbacks; |
| 23 class IndexedDBBackingStore; | 24 class IndexedDBBackingStore; |
| 24 class IndexedDBFactory; | 25 class IndexedDBFactory; |
| 25 class IndexedDBKey; | 26 class IndexedDBKey; |
| 26 class IndexedDBKeyPath; | 27 class IndexedDBKeyPath; |
| 27 class IndexedDBKeyRange; | 28 class IndexedDBKeyRange; |
| 28 class IndexedDBTransaction; | 29 class IndexedDBTransaction; |
| 29 | 30 |
| 30 class CONTENT_EXPORT IndexedDBDatabase | 31 class CONTENT_EXPORT IndexedDBDatabase |
| 31 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { | 32 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); | 77 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 77 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } | 78 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } |
| 78 | 79 |
| 79 void CreateObjectStore(int64 transaction_id, | 80 void CreateObjectStore(int64 transaction_id, |
| 80 int64 object_store_id, | 81 int64 object_store_id, |
| 81 const string16& name, | 82 const string16& name, |
| 82 const IndexedDBKeyPath& key_path, | 83 const IndexedDBKeyPath& key_path, |
| 83 bool auto_increment); | 84 bool auto_increment); |
| 84 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); | 85 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); |
| 85 void CreateTransaction(int64 transaction_id, | 86 void CreateTransaction(int64 transaction_id, |
| 86 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks, | 87 IndexedDBConnection* connection, |
| 87 const std::vector<int64>& object_store_ids, | 88 const std::vector<int64>& object_store_ids, |
| 88 uint16 mode); | 89 uint16 mode); |
| 89 void Close(scoped_refptr<IndexedDBDatabaseCallbacks> callbacks); | 90 void Close(IndexedDBConnection* connection); |
| 90 | 91 |
| 91 void Commit(int64 transaction_id); | 92 void Commit(int64 transaction_id); |
| 92 void Abort(int64 transaction_id); | 93 void Abort(int64 transaction_id); |
| 93 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); | 94 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); |
| 94 | 95 |
| 95 void CreateIndex(int64 transaction_id, | 96 void CreateIndex(int64 transaction_id, |
| 96 int64 object_store_id, | 97 int64 object_store_id, |
| 97 int64 index_id, | 98 int64 index_id, |
| 98 const string16& name, | 99 const string16& name, |
| 99 const IndexedDBKeyPath& key_path, | 100 const IndexedDBKeyPath& key_path, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 friend class base::RefCounted<IndexedDBDatabase>; | 158 friend class base::RefCounted<IndexedDBDatabase>; |
| 158 | 159 |
| 159 IndexedDBDatabase(const string16& name, | 160 IndexedDBDatabase(const string16& name, |
| 160 IndexedDBBackingStore* database, | 161 IndexedDBBackingStore* database, |
| 161 IndexedDBFactory* factory, | 162 IndexedDBFactory* factory, |
| 162 const string16& unique_identifier); | 163 const string16& unique_identifier); |
| 163 ~IndexedDBDatabase(); | 164 ~IndexedDBDatabase(); |
| 164 | 165 |
| 165 bool IsOpenConnectionBlocked() const; | 166 bool IsOpenConnectionBlocked() const; |
| 166 bool OpenInternal(); | 167 bool OpenInternal(); |
| 167 void RunVersionChangeTransaction( | 168 void RunVersionChangeTransaction(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 168 scoped_refptr<IndexedDBCallbacks> callbacks, | 169 scoped_ptr<IndexedDBConnection> connection, |
| 169 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 170 int64 transaction_id, |
| 170 int64 transaction_id, | 171 int64 requested_version, |
| 171 int64 requested_version, | 172 WebKit::WebIDBCallbacks::DataLoss data_loss); |
| 172 WebKit::WebIDBCallbacks::DataLoss data_loss); | |
| 173 void RunVersionChangeTransactionFinal( | 173 void RunVersionChangeTransactionFinal( |
| 174 scoped_refptr<IndexedDBCallbacks> callbacks, | 174 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 175 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 175 scoped_ptr<IndexedDBConnection> connection, |
| 176 int64 transaction_id, | 176 int64 transaction_id, |
| 177 int64 requested_version); | 177 int64 requested_version); |
| 178 void RunVersionChangeTransactionFinal( | 178 void RunVersionChangeTransactionFinal( |
| 179 scoped_refptr<IndexedDBCallbacks> callbacks, | 179 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 180 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 180 scoped_ptr<IndexedDBConnection> connection, |
| 181 int64 transaction_id, | 181 int64 transaction_id, |
| 182 int64 requested_version, | 182 int64 requested_version, |
| 183 WebKit::WebIDBCallbacks::DataLoss data_loss); | 183 WebKit::WebIDBCallbacks::DataLoss data_loss); |
| 184 size_t ConnectionCount() const; | 184 size_t ConnectionCount() const; |
| 185 void ProcessPendingCalls(); | 185 void ProcessPendingCalls(); |
| 186 | 186 |
| 187 bool IsDeleteDatabaseBlocked() const; | 187 bool IsDeleteDatabaseBlocked() const; |
| 188 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); | 188 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 189 | 189 |
| 190 class VersionChangeOperation; | 190 class VersionChangeOperation; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 203 | 203 |
| 204 IndexedDBTransactionCoordinator transaction_coordinator_; | 204 IndexedDBTransactionCoordinator transaction_coordinator_; |
| 205 IndexedDBTransaction* running_version_change_transaction_; | 205 IndexedDBTransaction* running_version_change_transaction_; |
| 206 | 206 |
| 207 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; | 207 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; |
| 208 TransactionMap transactions_; | 208 TransactionMap transactions_; |
| 209 | 209 |
| 210 class PendingOpenCall; | 210 class PendingOpenCall; |
| 211 typedef std::list<PendingOpenCall*> PendingOpenCallList; | 211 typedef std::list<PendingOpenCall*> PendingOpenCallList; |
| 212 PendingOpenCallList pending_open_calls_; | 212 PendingOpenCallList pending_open_calls_; |
| 213 scoped_ptr<PendingOpenCall> pending_run_version_change_transaction_call_; | 213 |
| 214 scoped_ptr<PendingOpenCall> pending_second_half_open_; | 214 class PendingUpgradeCall; |
| 215 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; |
| 216 class PendingSuccessCall; |
| 217 scoped_ptr<PendingSuccessCall> pending_second_half_open_; |
| 215 | 218 |
| 216 class PendingDeleteCall; | 219 class PendingDeleteCall; |
| 217 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 220 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
| 218 PendingDeleteCallList pending_delete_calls_; | 221 PendingDeleteCallList pending_delete_calls_; |
| 219 | 222 |
| 220 typedef list_set<scoped_refptr<IndexedDBDatabaseCallbacks> > | 223 typedef list_set<IndexedDBConnection*> ConnectionSet; |
| 221 DatabaseCallbacksSet; | 224 ConnectionSet connections_; |
| 222 DatabaseCallbacksSet database_callbacks_set_; | |
| 223 | 225 |
| 224 bool closing_connection_; | 226 bool closing_connection_; |
| 225 }; | 227 }; |
| 226 | 228 |
| 227 } // namespace content | 229 } // namespace content |
| 228 | 230 |
| 229 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 231 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |