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

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

Issue 838453003: Open the LoginDatabase on the DB thread, not the UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits from vabr@. Created 5 years, 11 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
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 a9bf8a73cc2be22b69d71bfb7a861933d9c5fd11..c70e650e02c8934162be96747ecf76bdd54f4142 100644
--- a/components/password_manager/core/browser/login_database.cc
+++ b/components/password_manager/core/browser/login_database.cc
@@ -153,13 +153,14 @@ void LogTimesUsedStat(const std::string& name, int sample) {
} // namespace
-LoginDatabase::LoginDatabase() {
+LoginDatabase::LoginDatabase(const base::FilePath& db_path)
+ : db_path_(db_path) {
}
LoginDatabase::~LoginDatabase() {
}
-bool LoginDatabase::Init(const base::FilePath& db_path) {
+bool LoginDatabase::Init() {
// Set pragmas for a small, private database (based on WebDatabase).
db_.set_page_size(2048);
db_.set_cache_size(32);
@@ -171,7 +172,7 @@ bool LoginDatabase::Init(const base::FilePath& db_path) {
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("138903 LoginDatabase::Init db init"));
- if (!db_.Open(db_path)) {
+ if (!db_.Open(db_path_)) {
LOG(WARNING) << "Unable to open the password store database.";
return false;
}
@@ -199,9 +200,6 @@ bool LoginDatabase::Init(const base::FilePath& db_path) {
return false;
}
- // Save the path for DeleteDatabaseFile().
- db_path_ = db_path;
-
// If the file on disk is an older database version, bring it up to date.
if (!MigrateOldVersionsAsNeeded()) {
LOG(WARNING) << "Unable to migrate database";
@@ -891,7 +889,7 @@ bool LoginDatabase::DeleteAndRecreateDatabaseFile() {
meta_table_.Reset();
db_.Close();
sql::Connection::Delete(db_path_);
- return Init(db_path_);
+ return Init();
}
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698