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

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: 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..6506742c851117a5ef9bf2ecba665f06109255c8 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,22 @@ 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(
jsbell 2014/03/26 18:16:58 Doesn't this write the file into the directory...
+ path_base, saved_origin_url, error);
+ HandleBackingStoreFailure(saved_origin_url);
+ if (!IndexedDBBackingStore::DestroyBackingStore(path_base, saved_origin_url)
jsbell 2014/03/26 18:16:58 ... which this deletes?
cmumford 2014/03/26 21:40:36 No, see second reply in this review.
jsbell 2014/03/26 22:49:00 Got it, thanks. Maybe add a comment here that the
+ .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