Index: sync/engine/syncer.cc |
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc |
index ac4688117d4caecaee71a29437d7fe4c7c300df2..0b6bed27b0d5bbec52c5a27df28a68086276ce52 100644 |
--- a/sync/engine/syncer.cc |
+++ b/sync/engine/syncer.cc |
@@ -4,6 +4,7 @@ |
#include "sync/engine/syncer.h" |
+#include "base/auto_reset.h" |
#include "base/location.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop.h" |
@@ -45,7 +46,8 @@ using sessions::SyncSession; |
using sessions::NudgeTracker; |
Syncer::Syncer(syncer::CancelationSignal* cancelation_signal) |
- : cancelation_signal_(cancelation_signal) { |
+ : cancelation_signal_(cancelation_signal), |
+ is_syncing_(false) { |
} |
Syncer::~Syncer() {} |
@@ -54,9 +56,14 @@ bool Syncer::ExitRequested() { |
return cancelation_signal_->IsSignalled(); |
} |
+bool Syncer::IsSyncing() const { |
+ return is_syncing_; |
+} |
+ |
bool Syncer::NormalSyncShare(ModelTypeSet request_types, |
NudgeTracker* nudge_tracker, |
SyncSession* session) { |
+ base::AutoReset<bool> is_syncing(&is_syncing_, true); |
HandleCycleBegin(session); |
if (nudge_tracker->IsGetUpdatesRequired() || |
session->context()->ShouldFetchUpdatesBeforeCommit()) { |
@@ -88,6 +95,7 @@ bool Syncer::ConfigureSyncShare( |
ModelTypeSet request_types, |
sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
SyncSession* session) { |
+ base::AutoReset<bool> is_syncing(&is_syncing_, true); |
VLOG(1) << "Configuring types " << ModelTypeSetToString(request_types); |
HandleCycleBegin(session); |
ConfigureGetUpdatesDelegate configure_delegate(source); |
@@ -104,6 +112,7 @@ bool Syncer::ConfigureSyncShare( |
bool Syncer::PollSyncShare(ModelTypeSet request_types, |
SyncSession* session) { |
+ base::AutoReset<bool> is_syncing(&is_syncing_, true); |
VLOG(1) << "Polling types " << ModelTypeSetToString(request_types); |
HandleCycleBegin(session); |
PollGetUpdatesDelegate poll_delegate; |
@@ -202,7 +211,12 @@ bool Syncer::HandleCycleEnd( |
sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
if (!ExitRequested()) { |
session->SendSyncCycleEndEventNotification(source); |
- return true; |
+ |
+ bool success = !sessions::HasSyncerError( |
+ session->status_controller().model_neutral_state()); |
+ if (success && source == sync_pb::GetUpdatesCallerInfo::PERIODIC) |
+ session->mutable_status_controller()->UpdatePollTime(); |
+ return success; |
} else { |
return false; |
} |