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

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

Issue 197333009: Handling LevelDB errors encountered after open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Commented that DestroyBackingStore leaves non LevelDB files alone Created 6 years, 9 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.cc
diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc
index 86af571319c65643c5a4acec2d533455f915c390..113060324000d267ae647109e0215af3bb4c417f 100644
--- a/content/browser/indexed_db/indexed_db_factory.cc
+++ b/content/browser/indexed_db/indexed_db_factory.cc
@@ -9,6 +9,7 @@
#include "base/time/time.h"
#include "content/browser/indexed_db/indexed_db_backing_store.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
+#include "content/browser/indexed_db/indexed_db_database_error.h"
#include "content/browser/indexed_db/indexed_db_tracing.h"
#include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
#include "third_party/WebKit/public/platform/WebIDBDatabaseException.h"
@@ -234,6 +235,24 @@ void IndexedDBFactory::HandleBackingStoreFailure(const GURL& origin_url) {
IndexedDBContextImpl::FORCE_CLOSE_BACKING_STORE_FAILURE);
}
+void IndexedDBFactory::HandleBackingStoreCorruption(
+ const GURL& origin_url,
+ const IndexedDBDatabaseError& error) {
+ // Make a copy of origin_url as this is likely a reference to a member of a
+ // backing store which this function will be deleting.
+ GURL saved_origin_url(origin_url);
+ DCHECK(context_);
+ base::FilePath path_base = context_->data_path();
+ IndexedDBBackingStore::RecordCorruptionInfo(
+ path_base, saved_origin_url, base::UTF16ToUTF8(error.message()));
+ HandleBackingStoreFailure(saved_origin_url);
+ // Note: DestroyBackingStore only deletes LevelDB files, leaving all others,
+ // so our corruption info file will remain.
+ if (!IndexedDBBackingStore::DestroyBackingStore(path_base, saved_origin_url)
+ .ok())
+ DLOG(ERROR) << "Unable to delete backing store";
+}
+
bool IndexedDBFactory::IsDatabaseOpen(const GURL& origin_url,
const base::string16& name) const {

Powered by Google App Engine
This is Rietveld 408576698