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

Unified Diff: content/browser/indexed_db/indexed_db_database.cc

Issue 93873017: IndexedDBFactory now ForceCloses databases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added multimap for more efficient origin->db mapping. Created 6 years, 12 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
Index: content/browser/indexed_db/indexed_db_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index ba53e662159375769f86f070d8fec6f560022555..440c041fd877e197cc18bb9645b565ef3b134f00 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -1589,6 +1589,16 @@ void IndexedDBDatabase::DeleteDatabaseFinal(
factory_->DatabaseDeleted(identifier_);
}
+void IndexedDBDatabase::ForceClose() {
+ // The database is also released when the last connection is closed. Because
+ // of this we make a copy of this db's connections as this object *will* be
+ // deleted before this function returns.
jsbell 2014/01/03 00:34:25 A more common pattern is to take a self-reference
cmumford 2014/01/03 21:34:01 Yes, a much better approach. I'll do that.
+ ConnectionSet conns(connections_);
+ for (ConnectionSet::iterator it = conns.begin(); it != conns.end(); ++it)
+ (*it)->ForceClose();
+ // This object has now been deleted!
+}
+
void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) {
DCHECK(connections_.count(connection));
DCHECK(connection->IsConnected());

Powered by Google App Engine
This is Rietveld 408576698