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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 | 257 |
258 class PendingDeleteCall; | 258 class PendingDeleteCall; |
259 class PendingSuccessCall; | 259 class PendingSuccessCall; |
260 class PendingUpgradeCall; | 260 class PendingUpgradeCall; |
261 | 261 |
262 typedef std::map<int64_t, IndexedDBTransaction*> TransactionMap; | 262 typedef std::map<int64_t, IndexedDBTransaction*> TransactionMap; |
263 typedef std::list<IndexedDBPendingConnection> PendingOpenCallList; | 263 typedef std::list<IndexedDBPendingConnection> PendingOpenCallList; |
264 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 264 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
265 typedef list_set<IndexedDBConnection*> ConnectionSet; | 265 typedef list_set<IndexedDBConnection*> ConnectionSet; |
266 | 266 |
267 bool IsUpgradeRunning() const; | |
268 bool IsUpgradePendingOrRunning() const; | |
269 | |
267 bool IsOpenConnectionBlocked() const; | 270 bool IsOpenConnectionBlocked() const; |
268 leveldb::Status OpenInternal(); | 271 leveldb::Status OpenInternal(); |
269 void RunVersionChangeTransaction( | 272 void RunVersionChangeTransaction( |
270 scoped_refptr<IndexedDBCallbacks> callbacks, | 273 scoped_refptr<IndexedDBCallbacks> callbacks, |
271 std::unique_ptr<IndexedDBConnection> connection, | 274 std::unique_ptr<IndexedDBConnection> connection, |
272 int64_t transaction_id, | 275 int64_t transaction_id, |
273 int64_t requested_version); | 276 int64_t requested_version); |
274 void RunVersionChangeTransactionFinal( | 277 void RunVersionChangeTransactionFinal( |
275 scoped_refptr<IndexedDBCallbacks> callbacks, | 278 scoped_refptr<IndexedDBCallbacks> callbacks, |
276 std::unique_ptr<IndexedDBConnection> connection, | 279 std::unique_ptr<IndexedDBConnection> connection, |
(...skipping 20 matching lines...) Expand all Loading... | |
297 | 300 |
298 scoped_refptr<IndexedDBBackingStore> backing_store_; | 301 scoped_refptr<IndexedDBBackingStore> backing_store_; |
299 IndexedDBDatabaseMetadata metadata_; | 302 IndexedDBDatabaseMetadata metadata_; |
300 | 303 |
301 const Identifier identifier_; | 304 const Identifier identifier_; |
302 scoped_refptr<IndexedDBFactory> factory_; | 305 scoped_refptr<IndexedDBFactory> factory_; |
303 | 306 |
304 IndexedDBTransactionCoordinator transaction_coordinator_; | 307 IndexedDBTransactionCoordinator transaction_coordinator_; |
305 | 308 |
306 TransactionMap transactions_; | 309 TransactionMap transactions_; |
310 | |
311 // An open request ends up here if: | |
312 // * There is a running or pending upgrade. | |
313 // * There are pending deletes. | |
314 // Requests here have *not* broadcast OnVersionChange if necessary. | |
315 // When no longer blocked, the OpenConnection() calls are remade. | |
307 PendingOpenCallList pending_open_calls_; | 316 PendingOpenCallList pending_open_calls_; |
317 | |
318 // This owns the connection for the first upgrade request (open with higher | |
319 // version) that could not be immediately processed. The request has already | |
320 // broadcast OnVersionChange if necessary. | |
308 std::unique_ptr<PendingUpgradeCall> | 321 std::unique_ptr<PendingUpgradeCall> |
309 pending_run_version_change_transaction_call_; | 322 pending_run_version_change_transaction_call_; |
323 | |
324 // This references a connection for an upgrade request while the upgrade | |
325 // transaction is running, so that the success/error result can be sent. It | |
326 // is not set until the upgrade transaction actually starts executing | |
327 // operations, so do not rely on it to determine if an upgrade is in | |
328 // progress. | |
310 std::unique_ptr<PendingSuccessCall> pending_second_half_open_; | 329 std::unique_ptr<PendingSuccessCall> pending_second_half_open_; |
330 | |
331 // A delete request ends up here if: | |
332 // * There is a running upgrade. | |
333 // Requests here have *not* broadcast OnVersionChange if necessary. | |
334 // When no longer blocked, DeleteDatabase() calls are remade. | |
311 PendingDeleteCallList pending_delete_calls_; | 335 PendingDeleteCallList pending_delete_calls_; |
312 | 336 |
337 // A delete request ends up here if: | |
338 // * There are open connections. | |
339 // Requests here have already broadcast OnVersionChange if necessary. | |
340 // When no longer blocked, DeleteDatabaseFinal() calls are made. | |
341 PendingDeleteCallList blocked_delete_calls_; | |
cmumford
2016/06/23 21:44:20
Why do we use a std::list instead of std::queue?
jsbell
2016/06/23 22:26:50
No good reason; probably ported mechanically from
jsbell
2016/06/23 23:00:27
Ah, I remember. you can't iterate over a std::queu
palakj1
2016/06/24 03:41:40
nit: the names pending_delete_calls_ and blocked_d
| |
342 | |
313 ConnectionSet connections_; | 343 ConnectionSet connections_; |
314 bool experimental_web_platform_features_enabled_; | 344 bool experimental_web_platform_features_enabled_; |
315 | 345 |
316 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); | 346 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); |
317 }; | 347 }; |
318 | 348 |
319 } // namespace content | 349 } // namespace content |
320 | 350 |
321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 351 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
OLD | NEW |