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

Unified Diff: storage/browser/quota/quota_database.cc

Issue 1236583002: Try to reset quota database which is suspected to be corrupted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/quota/quota_database.cc
diff --git a/storage/browser/quota/quota_database.cc b/storage/browser/quota/quota_database.cc
index 85e0000645c35c8d3dac722c82d997a69ebcb6c2..f91ca23cfae24f536cf6b15d95161a73fb4f5f19 100644
--- a/storage/browser/quota/quota_database.cc
+++ b/storage/browser/quota/quota_database.cc
@@ -475,11 +475,16 @@ bool QuotaDatabase::LazyOpen(bool create_if_needed) {
bool QuotaDatabase::EnsureDatabaseVersion() {
static const size_t kTableCount = arraysize(kTables);
static const size_t kIndexCount = arraysize(kIndexes);
- if (!sql::MetaTable::DoesTableExist(db_.get()))
- return CreateSchema(db_.get(), meta_table_.get(),
+ if (!sql::MetaTable::DoesTableExist(db_.get())) {
+ if (CreateSchema(db_.get(), meta_table_.get(),
kCurrentVersion, kCompatibleVersion,
kTables, kTableCount,
- kIndexes, kIndexCount);
+ kIndexes, kIndexCount))
+ return true;
+
+ LOG(ERROR) << "Failed to create schema: probably database is currupted.";
+ return ResetSchema();
michaeln 2015/07/23 19:54:18 I was wondering how this fixed a crash? Its not re
+ }
if (!meta_table_->Init(db_.get(), kCurrentVersion, kCompatibleVersion))
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698