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

Unified Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 9567022: Reinitialize the cookie database if the meta table gets corrupted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted test refactoring into a separate CL. Created 8 years, 10 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 | chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/sqlite_persistent_cookie_store.cc
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index e3007c6122b03ffeff17e67a729fe88620e2568e..d4243086a3bcd0056936c95474c67c275c7ba80f 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -768,10 +768,19 @@ bool SQLitePersistentCookieStore::Backend::EnsureDatabaseVersion() {
// Put future migration cases here.
- // When the version is too old, we just try to continue anyway, there should
- // not be a released product that makes a database too old for us to handle.
- LOG_IF(WARNING, cur_version < kCurrentVersionNumber) <<
- "Cookie database version " << cur_version << " is too old to handle.";
+ if (cur_version < kCurrentVersionNumber) {
+ meta_table_.Reset();
+ db_.reset(new sql::Connection);
+ if (!file_util::Delete(path_, false) ||
Scott Hess - ex-Googler 2012/03/01 22:15:15 I am a small bit concerned about whether we'll see
erikwright (departed) 2012/03/02 01:04:27 Done.
+ !db_->Open(path_) ||
+ !meta_table_.Init(
+ db_.get(), kCurrentVersionNumber, kCompatibleVersionNumber)) {
Scott Hess - ex-Googler 2012/03/01 22:15:15 I wish this wasn't replicating other code. It als
erikwright (departed) 2012/03/02 01:04:27 The caller actually calls InitTable only if this f
+ NOTREACHED() << "Unable to reset the cookie DB.";
+ meta_table_.Reset();
+ db_.reset();
+ return false;
+ }
+ }
return true;
}
« no previous file with comments | « no previous file | chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698