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

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

Issue 2642943002: Allow closing IndexedDB database before deleting (Closed)
Patch Set: Fixed compilation errors in tests Created 3 years, 11 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_factory_impl.cc
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.cc b/content/browser/indexed_db/indexed_db_factory_impl.cc
index f25989dcfa1326f4a3ccdd6a467d431ed6aa1bfe..a05a0601c3eb379f550dbcef110e702669b0eb1f 100644
--- a/content/browser/indexed_db/indexed_db_factory_impl.cc
+++ b/content/browser/indexed_db/indexed_db_factory_impl.cc
@@ -213,15 +213,20 @@ void IndexedDBFactoryImpl::DeleteDatabase(
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
scoped_refptr<IndexedDBCallbacks> callbacks,
const Origin& origin,
- const base::FilePath& data_directory) {
+ const base::FilePath& data_directory,
+ bool force_close) {
IDB_TRACE("IndexedDBFactoryImpl::DeleteDatabase");
IndexedDBDatabase::Identifier unique_identifier(origin, name);
const auto& it = database_map_.find(unique_identifier);
if (it != database_map_.end()) {
- // If there are any connections to the database, directly delete the
- // database.
- it->second->DeleteDatabase(callbacks);
- return;
+ if (force_close) {
+ it->second->ForceClose();
cmumford 2017/01/19 20:47:16 Any reason why we can't pass force_close into Dele
eostroukhov 2017/01/20 18:43:18 Did that, also added a test.
+ } else {
+ // If there are any connections to the database, directly delete the
+ // database.
+ it->second->DeleteDatabase(callbacks);
+ return;
+ }
}
// TODO(dgrogan): Plumb data_loss back to script eventually?

Powered by Google App Engine
This is Rietveld 408576698