Chromium Code Reviews| 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()); |