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

Unified Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 11287002: IndexedDB: Ensure pending callbacks are fired before dispatcher is torn down (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_layout_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/indexed_db/indexed_db_dispatcher.cc
diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc
index aa2d39cda8c2c1c54f7a3e5246271b160cb0036d..1345a37c719ecad25d6c6fd096d42d37c4ab414b 100644
--- a/content/common/indexed_db/indexed_db_dispatcher.cc
+++ b/content/common/indexed_db/indexed_db_dispatcher.cc
@@ -54,6 +54,26 @@ IndexedDBDispatcher::IndexedDBDispatcher() {
}
IndexedDBDispatcher::~IndexedDBDispatcher() {
+
+ // Clear any pending callbacks - which may result in dispatch requests -
+ // before marking the dispatcher as deleted.
+ for (IDMap<WebKit::WebIDBCallbacks, IDMapOwnPointer>::iterator
+ it(&pending_callbacks_); !it.IsAtEnd(); it.Advance()) {
+ pending_callbacks_.Remove(it.GetCurrentKey());
michaeln 2012/10/24 19:54:49 Odd that there's no .Clear() method on the IDMap<>
+ }
+ for (IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer>::iterator
+ it(&pending_database_callbacks_); !it.IsAtEnd(); it.Advance()) {
+ pending_database_callbacks_.Remove(it.GetCurrentKey());
+ }
+ for (IDMap<WebKit::WebIDBTransactionCallbacks, IDMapOwnPointer>::iterator
+ it(&pending_transaction_callbacks_); !it.IsAtEnd(); it.Advance()) {
+ pending_transaction_callbacks_.Remove(it.GetCurrentKey());
+ }
+
+ DCHECK(pending_callbacks_.IsEmpty());
+ DCHECK(pending_database_callbacks_.IsEmpty());
+ DCHECK(pending_transaction_callbacks_.IsEmpty());
+
g_idb_dispatcher_tls.Pointer()->Set(kHasBeenDeleted);
}
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_layout_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698