summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 21:16:52 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 21:16:52 +0000
commitf029b114a4fa8b7350a4b30e4b3e1329c7c9815f (patch)
tree0620afda41fdb67df1dc101e467dca83e9f6c2a9 /chrome
parent5c8899c6e31f922eae11e20367d71acde966d2ce (diff)
downloadchromium_src-f029b114a4fa8b7350a4b30e4b3e1329c7c9815f.zip
chromium_src-f029b114a4fa8b7350a4b30e4b3e1329c7c9815f.tar.gz
chromium_src-f029b114a4fa8b7350a4b30e4b3e1329c7c9815f.tar.bz2
Eliminate a race between the syncerthread delivering PAUSED
notifications and the syncmanager subscribing to them. Review URL: http://codereview.chromium.org/1096006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42257 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/engine/syncapi.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index e807d3d..64b7e41 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -1379,6 +1379,11 @@ bool SyncManager::SyncInternal::Init(
syncer_thread()->WatchTalkMediator(talk_mediator());
allstatus()->WatchSyncerThread(syncer_thread());
+ // Subscribe to the syncer thread's channel.
+ syncer_event_.reset(
+ NewEventListenerHookup(syncer_thread()->relay_channel(), this,
+ &SyncInternal::HandleSyncerEvent));
+
syncer_thread()->Start(); // Start the syncer thread. This won't actually
// result in any syncing until at least the
// DirectoryManager broadcasts the OPENED event,
@@ -1718,10 +1723,8 @@ SyncManager::Status SyncManager::SyncInternal::ComputeAggregatedStatus() {
void SyncManager::SyncInternal::HandleSyncerEvent(const SyncerEvent& event) {
if (!initialized()) {
- // We get here if A) We have successfully authenticated at least once
- // (because we attach HandleSyncerEvent only once we receive notification
- // of successful authentication [locally or otherwise]), but B) the initial
- // sync had not completed at that time.
+ // This could be the first time that the syncer has completed a full
+ // download; if so, we should signal that initialization is complete.
if (event.snapshot->is_share_usable)
MarkAndNotifyInitializationComplete();
return;
@@ -1825,13 +1828,10 @@ void SyncManager::SyncInternal::HandleAuthWatcherEvent(
if (lookup->initial_sync_ended())
MarkAndNotifyInitializationComplete();
- }
- {
- // Start watching the syncer channel directly here.
- DCHECK(syncer_thread() != NULL);
- syncer_event_.reset(
- NewEventListenerHookup(syncer_thread()->relay_channel(), this,
- &SyncInternal::HandleSyncerEvent));
+
+ // If we are transitioning from having bad to good credentials, that
+ // could mean that the syncer can now make forward progress. Wake it.
+ syncer_thread_->NudgeSyncer(0, SyncerThread::kLocal);
}
return;
// Authentication failures translate to GoogleServiceAuthError events.