Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

Unified Diff: components/password_manager/core/browser/password_store_default.h

Issue 838453003: Open the LoginDatabase on the DB thread, not the UI thread. (Closed) Base URL:
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/password_store_default.h
diff --git a/components/password_manager/core/browser/password_store_default.h b/components/password_manager/core/browser/password_store_default.h
index 7f42c192fd373401de4f33704211c8a71f0e4305..faaebec1a837e148ad5294ae71cc458ac8eccf14 100644
--- a/components/password_manager/core/browser/password_store_default.h
+++ b/components/password_manager/core/browser/password_store_default.h
@@ -17,15 +17,24 @@ namespace password_manager {
// the LoginDatabase.
class PasswordStoreDefault : public PasswordStore {
- // Takes ownership of |login_db|.
+ // The |login_db| must not have been Init()-ed yet. It will be initialized in
+ // a deferred manner on the DB thread.
scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
- LoginDatabase* login_db);
+ scoped_ptr<LoginDatabase> login_db);
+ bool Init(const syncer::SyncableService::StartSyncFlare& flare) override;
+ // To be used only for testing.
+ LoginDatabase* login_db() const { return login_db_.get(); }
~PasswordStoreDefault() override;
+ // Opens |login_db_| on the DB thread.
+ void InitOnDBThread();
// Implements PasswordStore interface.
void ReportMetricsImpl(const std::string& sync_username,
bool custom_passphrase_sync_enabled) override;
@@ -57,6 +66,10 @@ class PasswordStoreDefault : public PasswordStore {
+ // The login SQL database. The LoginDatabase instance is received via the
+ // in an uninitialized state, so as to allow injecting mocks, then Init() is
+ // called on the DB thread in a deferred manner. If opening the DB fails,
+ // |login_db_| will be reset and stay NULL for the lifetime of |this|.
scoped_ptr<LoginDatabase> login_db_;

Powered by Google App Engine
This is Rietveld 408576698