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

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

Issue 2642943002: Allow closing IndexedDB database before deleting (Closed)
Patch Set: Allow closing IndexedDB database before deleting 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_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 1b266ef4c698b5ca7b6a2737d82629be4cb4f791..239222981f051bdf405c00b47895af89dfa7e8cd 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -311,8 +311,9 @@ class IndexedDBDatabase::DeleteRequest
}
void DoDelete() {
- leveldb::Status s =
- db_->backing_store_->DeleteDatabase(db_->metadata_.name);
+ leveldb::Status s;
+ if (db_->backing_store_)
+ s = db_->backing_store_->DeleteDatabase(db_->metadata_.name);
if (!s.ok()) {
// TODO(jsbell): Consider including sanitized leveldb status message.
IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
@@ -1847,8 +1848,13 @@ void IndexedDBDatabase::OpenConnection(
}
void IndexedDBDatabase::DeleteDatabase(
- scoped_refptr<IndexedDBCallbacks> callbacks) {
+ scoped_refptr<IndexedDBCallbacks> callbacks,
+ bool force_close) {
AppendRequest(base::MakeUnique<DeleteRequest>(this, callbacks));
+ // Close the connections only after the request is queued to make sure
+ // the store is still open.
+ if (force_close)
+ ForceClose();
}
void IndexedDBDatabase::ForceClose() {

Powered by Google App Engine
This is Rietveld 408576698