summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/sync_manager_impl.cc
diff options
context:
space:
mode:
authorzea <zea@chromium.org>2015-05-13 10:42:56 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-13 17:43:26 +0000
commit3777d8727d7b4caedfb72bfdcbe2fea1f1d1d594 (patch)
tree40d9ae71927722ec479e0cec1334eb7f4e0d73b7 /sync/internal_api/sync_manager_impl.cc
parenta28d21d2dd33c3b1e44a67b8e396a1478c7b2b62 (diff)
downloadchromium_src-3777d8727d7b4caedfb72bfdcbe2fea1f1d1d594.zip
chromium_src-3777d8727d7b4caedfb72bfdcbe2fea1f1d1d594.tar.gz
chromium_src-3777d8727d7b4caedfb72bfdcbe2fea1f1d1d594.tar.bz2
[Sync] Refactoring polling to be reliable.
Polling is now an important component of sync health, as it can sometimes be the only time we'll query for certain datatypes. As such, the following has changed: - Polls that fail will be retried (with backoff). - As such, the logic to force a poll after an auth error isn't needed anymore - The last successful poll time will be persisted in the sync prefs. - On startup, schedule the first poll for last_poll_time + poll_interval (or Now(), whichever is latest). - Receiving a new poll interval from the server will update the poll timer - The poll timer is now a one shot timer, and only restarts on success - Some code cleanup to make the above more straightforward BUG=482154 Review URL: https://codereview.chromium.org/1132013004 Cr-Commit-Position: refs/heads/master@{#329669}
Diffstat (limited to 'sync/internal_api/sync_manager_impl.cc')
-rw-r--r--sync/internal_api/sync_manager_impl.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index 387b1d2..fe0bb0f 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -218,7 +218,7 @@ void SyncManagerImpl::ConfigureSyncer(
ready_task,
retry_task);
- scheduler_->Start(SyncScheduler::CONFIGURATION_MODE);
+ scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
scheduler_->ScheduleConfiguration(params);
}
@@ -334,7 +334,7 @@ void SyncManagerImpl::Init(InitArgs* args) {
scheduler_ = args->internal_components_factory->BuildScheduler(
name_, session_context_.get(), args->cancelation_signal).Pass();
- scheduler_->Start(SyncScheduler::CONFIGURATION_MODE);
+ scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
initialized_ = true;
@@ -406,7 +406,8 @@ void SyncManagerImpl::OnPassphraseTypeChanged(
}
void SyncManagerImpl::StartSyncingNormally(
- const ModelSafeRoutingInfo& routing_info) {
+ const ModelSafeRoutingInfo& routing_info,
+ base::Time last_poll_time) {
// Start the sync scheduler.
// TODO(sync): We always want the newest set of routes when we switch back
// to normal mode. Figure out how to enforce set_routing_info is always
@@ -414,7 +415,8 @@ void SyncManagerImpl::StartSyncingNormally(
// mode.
DCHECK(thread_checker_.CalledOnValidThread());
session_context_->SetRoutingInfo(routing_info);
- scheduler_->Start(SyncScheduler::NORMAL_MODE);
+ scheduler_->Start(SyncScheduler::NORMAL_MODE,
+ last_poll_time);
}
syncable::Directory* SyncManagerImpl::directory() {