diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 19:40:21 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 19:40:21 +0000 |
commit | c4925d5805396a5e15ae4297b6173b5ed2610a93 (patch) | |
tree | e821154e001de7b637657f8f5b096000cb482be2 /webkit/appcache/appcache_database.cc | |
parent | 93330676dddfffc05a070df8e7b7e91fd5801ca2 (diff) | |
download | chromium_src-c4925d5805396a5e15ae4297b6173b5ed2610a93.zip chromium_src-c4925d5805396a5e15ae4297b6173b5ed2610a93.tar.gz chromium_src-c4925d5805396a5e15ae4297b6173b5ed2610a93.tar.bz2 |
AppCache: If we can't read the existing data delete it and start over.
BUG=38360
TEST=some unit tests apply, but no new tests for this specifically
Review URL: http://codereview.chromium.org/1562005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_database.cc')
-rw-r--r-- | webkit/appcache/appcache_database.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_database.cc b/webkit/appcache/appcache_database.cc index a1aa59b..a93b744 100644 --- a/webkit/appcache/appcache_database.cc +++ b/webkit/appcache/appcache_database.cc @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "webkit/appcache/appcache_entry.h" +#include "webkit/appcache/appcache_histograms.h" #include "webkit/database/quota_table.h" // Schema ------------------------------------------------------------------- @@ -994,10 +995,22 @@ bool AppCacheDatabase::LazyOpen(bool create_if_needed) { } if (!opened || !EnsureDatabaseVersion()) { + LOG(ERROR) << "Failed to open the appcache database."; + AppCacheHistograms::CountInitResult( + AppCacheHistograms::SQL_DATABASE_ERROR); + + // We're unable to open the database. This is a fatal error + // which we can't recover from. We try to handle it by deleting + // the existing appcache data and starting with a clean slate in + // this browser session. + if (!use_in_memory_db && DeleteExistingAndCreateNewDatabase()) + return true; + Disable(); return false; } + AppCacheHistograms::CountInitResult(AppCacheHistograms::INIT_OK); return true; } @@ -1078,6 +1091,7 @@ void AppCacheDatabase::ResetConnectionAndTables() { bool AppCacheDatabase::DeleteExistingAndCreateNewDatabase() { DCHECK(!db_file_path_.empty()); DCHECK(file_util::PathExists(db_file_path_)); + LOG(INFO) << "Deleting existing appcache data and starting over."; ResetConnectionAndTables(); |