Index: chrome/browser/history/history_database.cc |
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc |
index 0e65f959f3bf229d1f76059225a188880f2ba218..354ac1ad3801c06ab16a1644041c2385125ff2a0 100644 |
--- a/chrome/browser/history/history_database.cc |
+++ b/chrome/browser/history/history_database.cc |
@@ -28,7 +28,7 @@ namespace { |
// Current version number. We write databases at the "current" version number, |
// but any previous version that can read the "compatible" one can make do with |
// or database without *too* many bad effects. |
-static const int kCurrentVersionNumber = 22; |
+static const int kCurrentVersionNumber = 23; |
static const int kCompatibleVersionNumber = 16; |
static const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; |
@@ -332,6 +332,17 @@ sql::InitStatus HistoryDatabase::EnsureCurrentVersion( |
++cur_version; |
meta_table_.SetVersionNumber(cur_version); |
} |
+ |
+ if (cur_version == 22) { |
+ if (!MigrateDownloadsState()) { |
+ LOG(WARNING) << "Unable to fix invalid downloads state values"; |
+ // Invalid state values may cause crashes. |
+ return sql::INIT_FAILURE; |
+ } |
+ cur_version++; |
+ meta_table_.SetVersionNumber(cur_version); |
+ } |
+ |
// 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 < GetCurrentVersion()) << |