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); |
} |