diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 00:14:44 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 00:14:44 +0000 |
commit | c91a523e35cbbf233f82ae17a340b92459da5103 (patch) | |
tree | b2250e24027c075b4939f0735e11d435a528ca93 /chrome/browser/webdata | |
parent | 6e9c8ffa0f3e084c2cdeac1bd4e0f506e04b5036 (diff) | |
download | chromium_src-c91a523e35cbbf233f82ae17a340b92459da5103.zip chromium_src-c91a523e35cbbf233f82ae17a340b92459da5103.tar.gz chromium_src-c91a523e35cbbf233f82ae17a340b92459da5103.tar.bz2 |
Add compatible version support since it was only halfway in place, and try and make our database versioning code and logging more similar across various consumers.
The compatible version support isn't really used yet. It was going to be used for my cookie change until we decided that the old code was too busted to be forward-compatible. It seems worthwhile to put this in but maybe I am wrong.
The logging similarity stuff is fairly useful. In a couple consumers in the old code, we DLOGed instead of LOGing, which meant that most people would get nothing in the log at all. I think it's a little weird that in a lot of these consumers, logging is all we do; for example, if you use a too-new cookie DB, you get output in the log, but no actual dialog box while the browser is running -- your cookies just silently don't get saved to disk. Seems bad, but I'm not prepared to try and do major surgery to address that (and add translated strings, etc.). At least now we'll actually get log messages in release builds instead of nothing at all.
Because my last-access change touches this code, I'm considering asking that this change be merged back to the branch.
Review URL: http://codereview.chromium.org/8712
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r-- | chrome/browser/webdata/web_database.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index 5e14723..dca2924 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -77,6 +77,7 @@ using base::Time; // Current version number. static const int kCurrentVersionNumber = 21; +static const int kCompatibleVersionNumber = 21; // Keys used in the meta table. static const char* kDefaultSearchProviderKey = "Default Search Provider ID"; @@ -150,10 +151,11 @@ bool WebDatabase::Init(const std::wstring& db_name) { transaction.Begin(); // Version check. - if (!meta_table_.Init(std::string(), kCurrentVersionNumber, db_)) + if (!meta_table_.Init(std::string(), kCurrentVersionNumber, + kCompatibleVersionNumber, db_)) return false; if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) { - LOG(WARNING) << "Web database is too new"; + LOG(WARNING) << "Web database is too new."; return false; } @@ -870,11 +872,13 @@ void WebDatabase::MigrateOldVersionsAsNeeded() { "ALTER TABLE keywords ADD COLUMN autogenerate_keyword " "INTEGER DEFAULT 0", NULL, NULL, NULL) != SQLITE_OK) { NOTREACHED(); + LOG(WARNING) << "Unable to update web database to version 21."; return; } - ++current_version; - meta_table_.SetVersionNumber(current_version); - meta_table_.SetCompatibleVersionNumber(current_version); + meta_table_.SetVersionNumber(21); + meta_table_.SetCompatibleVersionNumber( + std::min(21, kCompatibleVersionNumber)); + // FALL THROUGH // Add successive versions here. Each should set the version number and // compatible version number as appropriate, then fall through to the next |