diff options
-rw-r--r-- | chrome/browser/sync/glue/password_change_processor.cc | 11 | ||||
-rw-r--r-- | chrome/browser/sync/glue/password_change_processor.h | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/chrome/browser/sync/glue/password_change_processor.cc b/chrome/browser/sync/glue/password_change_processor.cc index 10433d6..c02bfc3 100644 --- a/chrome/browser/sync/glue/password_change_processor.cc +++ b/chrome/browser/sync/glue/password_change_processor.cc @@ -259,12 +259,20 @@ void PasswordChangeProcessor::Disconnect() { void PasswordChangeProcessor::StartImpl(Profile* profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); password_store_->ScheduleTask( - base::Bind(&PasswordChangeProcessor::StartObserving, + base::Bind(&PasswordChangeProcessor::InitObserving, base::Unretained(this))); } +void PasswordChangeProcessor::InitObserving() { + base::AutoLock lock(disconnect_lock_); + if (disconnected_) + return; + StartObserving(); +} + void PasswordChangeProcessor::StartObserving() { DCHECK(expected_loop_ == base::MessageLoop::current()); + disconnect_lock_.AssertAcquired(); notification_registrar_.Add(this, chrome::NOTIFICATION_LOGINS_CHANGED, content::Source<PasswordStore>(password_store_)); @@ -272,6 +280,7 @@ void PasswordChangeProcessor::StartObserving() { void PasswordChangeProcessor::StopObserving() { DCHECK(expected_loop_ == base::MessageLoop::current()); + disconnect_lock_.AssertAcquired(); notification_registrar_.Remove( this, chrome::NOTIFICATION_LOGINS_CHANGED, diff --git a/chrome/browser/sync/glue/password_change_processor.h b/chrome/browser/sync/glue/password_change_processor.h index 5378403..5a5d80e 100644 --- a/chrome/browser/sync/glue/password_change_processor.h +++ b/chrome/browser/sync/glue/password_change_processor.h @@ -67,6 +67,9 @@ class PasswordChangeProcessor : public ChangeProcessor, void StartObserving(); void StopObserving(); + // Registers to observe password change for the first time. + void InitObserving(); + // The two models should be associated according to this ModelAssociator. PasswordModelAssociator* model_associator_; |