Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: content/browser/indexed_db/indexed_db_database.h

Issue 2084053004: IndexedDB: Defer delete calls when there is a running upgrade (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, made delete lists contain unique_ptrs Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698