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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 friend class base::RefCounted<IndexedDBDatabase>; | 260 friend class base::RefCounted<IndexedDBDatabase>; |
261 friend class IndexedDBClassFactory; | 261 friend class IndexedDBClassFactory; |
262 | 262 |
263 class PendingDeleteCall; | 263 class PendingDeleteCall; |
264 class PendingSuccessCall; | 264 class PendingSuccessCall; |
265 class PendingUpgradeCall; | 265 class PendingUpgradeCall; |
266 | 266 |
267 typedef std::map<int64_t, IndexedDBTransaction*> TransactionMap; | 267 typedef std::map<int64_t, IndexedDBTransaction*> TransactionMap; |
268 typedef list_set<IndexedDBConnection*> ConnectionSet; | 268 typedef list_set<IndexedDBConnection*> ConnectionSet; |
269 | 269 |
| 270 bool IsUpgradeRunning() const; |
| 271 bool IsUpgradePendingOrRunning() const; |
| 272 |
270 bool IsOpenConnectionBlocked() const; | 273 bool IsOpenConnectionBlocked() const; |
271 leveldb::Status OpenInternal(); | 274 leveldb::Status OpenInternal(); |
272 void RunVersionChangeTransaction( | 275 void RunVersionChangeTransaction( |
273 scoped_refptr<IndexedDBCallbacks> callbacks, | 276 scoped_refptr<IndexedDBCallbacks> callbacks, |
274 std::unique_ptr<IndexedDBConnection> connection, | 277 std::unique_ptr<IndexedDBConnection> connection, |
275 int64_t transaction_id, | 278 int64_t transaction_id, |
276 int64_t requested_version); | 279 int64_t requested_version); |
277 void RunVersionChangeTransactionFinal( | 280 void RunVersionChangeTransactionFinal( |
278 scoped_refptr<IndexedDBCallbacks> callbacks, | 281 scoped_refptr<IndexedDBCallbacks> callbacks, |
279 std::unique_ptr<IndexedDBConnection> connection, | 282 std::unique_ptr<IndexedDBConnection> connection, |
(...skipping 20 matching lines...) Expand all Loading... |
300 | 303 |
301 scoped_refptr<IndexedDBBackingStore> backing_store_; | 304 scoped_refptr<IndexedDBBackingStore> backing_store_; |
302 IndexedDBDatabaseMetadata metadata_; | 305 IndexedDBDatabaseMetadata metadata_; |
303 | 306 |
304 const Identifier identifier_; | 307 const Identifier identifier_; |
305 scoped_refptr<IndexedDBFactory> factory_; | 308 scoped_refptr<IndexedDBFactory> factory_; |
306 | 309 |
307 IndexedDBTransactionCoordinator transaction_coordinator_; | 310 IndexedDBTransactionCoordinator transaction_coordinator_; |
308 | 311 |
309 TransactionMap transactions_; | 312 TransactionMap transactions_; |
| 313 |
| 314 // An open request ends up here if: |
| 315 // * There is a running or pending upgrade. |
| 316 // * There are pending deletes. |
| 317 // Requests here have *not* broadcast OnVersionChange if necessary. |
| 318 // When no longer blocked, the OpenConnection() calls are remade. |
310 std::queue<IndexedDBPendingConnection> pending_open_calls_; | 319 std::queue<IndexedDBPendingConnection> pending_open_calls_; |
| 320 |
| 321 // This owns the connection for the first upgrade request (open with higher |
| 322 // version) that could not be immediately processed. The request has already |
| 323 // broadcast OnVersionChange if necessary. |
311 std::unique_ptr<PendingUpgradeCall> | 324 std::unique_ptr<PendingUpgradeCall> |
312 pending_run_version_change_transaction_call_; | 325 pending_run_version_change_transaction_call_; |
| 326 |
| 327 // This references a connection for an upgrade request while the upgrade |
| 328 // transaction is running, so that the success/error result can be sent. It |
| 329 // is not set until the upgrade transaction actually starts executing |
| 330 // operations, so do not rely on it to determine if an upgrade is in |
| 331 // progress. |
313 std::unique_ptr<PendingSuccessCall> pending_second_half_open_; | 332 std::unique_ptr<PendingSuccessCall> pending_second_half_open_; |
314 std::list<PendingDeleteCall*> pending_delete_calls_; | 333 |
| 334 // A delete request ends up here if: |
| 335 // * There is a running upgrade. |
| 336 // Requests here have *not* broadcast OnVersionChange if necessary. |
| 337 // When no longer blocked, DeleteDatabase() calls are remade. |
| 338 std::list<std::unique_ptr<PendingDeleteCall>> pending_delete_calls_; |
| 339 |
| 340 // A delete request ends up here if: |
| 341 // * There are open connections. |
| 342 // Requests here have already broadcast OnVersionChange if necessary. |
| 343 // When no longer blocked, DeleteDatabaseFinal() calls are made. |
| 344 std::list<std::unique_ptr<PendingDeleteCall>> blocked_delete_calls_; |
315 | 345 |
316 ConnectionSet connections_; | 346 ConnectionSet connections_; |
317 bool experimental_web_platform_features_enabled_; | 347 bool experimental_web_platform_features_enabled_; |
318 | 348 |
319 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); | 349 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); |
320 }; | 350 }; |
321 | 351 |
322 } // namespace content | 352 } // namespace content |
323 | 353 |
324 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 354 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
OLD | NEW |