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

Unified Diff: components/password_manager/core/browser/login_database.cc

Issue 1238283002: Collect SQL statistics on passwords. Print more information on error. (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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/login_database.cc
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc
index 52b726da47080ac93ccb7961feee27602ba1e04e..4ab709a180ada8afe5f047d39c7eab3c5afb9c7d 100644
--- a/components/password_manager/core/browser/login_database.cc
+++ b/components/password_manager/core/browser/login_database.cc
@@ -212,48 +212,59 @@ bool LoginDatabase::Init() {
db_.set_cache_size(32);
db_.set_exclusive_locking();
db_.set_restrict_to_user();
+ db_.set_histogram_tag("Passwords");
if (!db_.Open(db_path_)) {
- LOG(WARNING) << "Unable to open the password store database.";
+ LOG(ERROR) << "Unable to open the password store database.";
return false;
}
sql::Transaction transaction(&db_);
- transaction.Begin();
+ if (!transaction.Begin()) {
+ LOG(ERROR) << "Unable to start a transaction.";
+ db_.Close();
+ return false;
+ }
// Check the database version.
if (!meta_table_.Init(&db_, kCurrentVersionNumber,
kCompatibleVersionNumber)) {
+ LOG(ERROR) << "Unable to create the meta table.";
db_.Close();
return false;
}
if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) {
- LOG(WARNING) << "Password store database is too new.";
+ LOG(ERROR) << "Password store database is too new, kCurrentVersionNumber="
+ << kCurrentVersionNumber << ", GetCompatibleVersionNumber="
+ << meta_table_.GetCompatibleVersionNumber();
db_.Close();
return false;
}
// Initialize the tables.
if (!InitLoginsTable()) {
- LOG(WARNING) << "Unable to initialize the logins table.";
+ LOG(ERROR) << "Unable to initialize the logins table.";
db_.Close();
return false;
}
if (!stats_table_.Init(&db_)) {
- LOG(WARNING) << "Unable to initialize the stats table.";
+ LOG(ERROR) << "Unable to initialize the stats table.";
db_.Close();
return false;
}
// If the file on disk is an older database version, bring it up to date.
if (!MigrateOldVersionsAsNeeded()) {
- LOG(WARNING) << "Unable to migrate database";
+ LOG(ERROR) << "Unable to migrate database from "
+ << meta_table_.GetVersionNumber() << " to "
+ << kCurrentVersionNumber;
db_.Close();
return false;
}
if (!transaction.Commit()) {
+ LOG(ERROR) << "Unable to commit a transaction.";
db_.Close();
return false;
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698