diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:05:22 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:05:22 +0000 |
commit | 7cef1c446c9870cc98fbe5d6cd871485f6e756cf (patch) | |
tree | af901f1c24b49e9f56007ed0e35794b5b2e40aee /chrome/browser/sync/glue/sync_backend_host.cc | |
parent | 8979ccea27f79faf5bee441547600a95c8eedce4 (diff) | |
download | chromium_src-7cef1c446c9870cc98fbe5d6cd871485f6e756cf.zip chromium_src-7cef1c446c9870cc98fbe5d6cd871485f6e756cf.tar.gz chromium_src-7cef1c446c9870cc98fbe5d6cd871485f6e756cf.tar.bz2 |
Fix sync startup ordering to make sense and be less broken (though not perfect yet).
Trigger OnBackendInitialized when the syncable::Directory is opened, and cue the DataTypeManager when that happens.
Fix a bug where entering the wrong password on re-login UI results in inability to log in to sync forever, as the UI gets stuck in the "Authenticating...' state.
Overhaul the tests to
1) actually use the abstract superclass and not copy/paste the same code (and redefine the same variables, shadowing protected ones in the super!),
2) to not use two SyncBackendHost objects, which makes it really confusing to follow what's happening,
3) not rely on anonymous OnStateChanged() notifications to perform crucial init tasks (which was also really confusing and brittle) by either a) removing the need to listen altogether, or b) listen for specific notifications.
4) unify root node creation, and
5) kill verbose and self proclaimed "uninteresting" gmock output.
BUG=47957
TEST=unit_tests (ProfileSync*)
Review URL: http://codereview.chromium.org/2834032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue/sync_backend_host.cc')
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index e4f681c1..15d78cf 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -121,7 +121,7 @@ void SyncBackendHost::Authenticate(const std::string& username, username, password, captcha)); } -void SyncBackendHost::StartSyncing() { +void SyncBackendHost::StartSyncingWithServer() { core_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoStartSyncing)); } @@ -137,10 +137,12 @@ void SyncBackendHost::Shutdown(bool sync_disabled) { // - SyncerThread // - CoreThread // - UI Thread (stops some time after we return from this call). - core_thread_.message_loop()->PostTask(FROM_HERE, - NewRunnableMethod(core_.get(), - &SyncBackendHost::Core::DoShutdown, - sync_disabled)); + if (core_thread_.IsRunning()) { // Not running in tests. + core_thread_.message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(core_.get(), + &SyncBackendHost::Core::DoShutdown, + sync_disabled)); + } // Before joining the core_thread_, we wait for the UIModelWorker to // give us the green light that it is not depending on the frontend_loop_ to @@ -536,9 +538,12 @@ void SyncBackendHost::Core::OnInitializationComplete() { } void SyncBackendHost::Core::HandleInitalizationCompletedOnFrontendLoop() { - host_->frontend_->OnBackendInitialized(); + host_->HandleInitializationCompletedOnFrontendLoop(); } +void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() { + frontend_->OnBackendInitialized(); +} bool SyncBackendHost::Core::IsCurrentThreadSafeForModel( syncable::ModelType model_type) { |