diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-20 05:35:33 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-20 05:35:33 +0000 |
commit | 92816e3ba6049bd90ea487564ce109976d5733a6 (patch) | |
tree | 9a6f34e11dbd0f847d41f03ff20619ba2cdf17fe /sync/engine | |
parent | 9abe1698b556c9baa5f4dd74adf39b0ae1723e79 (diff) | |
download | chromium_src-92816e3ba6049bd90ea487564ce109976d5733a6.zip chromium_src-92816e3ba6049bd90ea487564ce109976d5733a6.tar.gz chromium_src-92816e3ba6049bd90ea487564ce109976d5733a6.tar.bz2 |
sync: Add pre-commit update avoidance mode + flag
This CL allows the syncer to avoid requesting updates from the server
prior to a commit if the nudge tracker determines that such a request is
not necessary. In general, the nudge tracker will consider such a
request to be unnecessary unless the sync cycle was triggered by a local
refresh request or an invalidation, or invalidations are disabled.
This behavior is enabled only if explicitly requested by the client or
the server. The client can enable this mode with the command-line flag
'--sync-enable-get-update-avoidance'. The server can toggle it on or
off with the 'pre_commit_update_avoidance' experiment. Unless at least
one of these flags are set, this CL will have no effect on syncer
behavior.
When this experimental mode is enabled, the SyncScheduler will use the
"short poll" interval rather than the "long poll". This should help
clients keep in sync with each other even if the experiment breaks.
Also included in this CL are some extensions to the python test server
to enable manual testing of the pre_commit_update_avoidance experiment
node.
BUG=147685
Review URL: https://chromiumcodereview.appspot.com/19309002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r-- | sync/engine/sync_scheduler_impl.cc | 3 | ||||
-rw-r--r-- | sync/engine/sync_scheduler_unittest.cc | 1 | ||||
-rw-r--r-- | sync/engine/syncer.cc | 19 | ||||
-rw-r--r-- | sync/engine/syncer_unittest.cc | 1 |
4 files changed, 15 insertions, 9 deletions
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc index fe377d4..3a904d1 100644 --- a/sync/engine/sync_scheduler_impl.cc +++ b/sync/engine/sync_scheduler_impl.cc @@ -616,7 +616,8 @@ void SyncSchedulerImpl::UpdateNudgeTimeRecords(ModelTypeSet types) { void SyncSchedulerImpl::AdjustPolling(PollAdjustType type) { DCHECK(CalledOnValidThread()); - TimeDelta poll = (!session_context_->notifications_enabled()) ? + TimeDelta poll = (!session_context_->notifications_enabled() || + !session_context_->ShouldFetchUpdatesBeforeCommit()) ? syncer_short_poll_interval_seconds_ : syncer_long_poll_interval_seconds_; bool rate_changed = !poll_timer_.IsRunning() || diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc index a55eb7f..3fb2042 100644 --- a/sync/engine/sync_scheduler_unittest.cc +++ b/sync/engine/sync_scheduler_unittest.cc @@ -150,6 +150,7 @@ class SyncSchedulerTest : public testing::Test { &extensions_activity_monitor_, std::vector<SyncEngineEventListener*>(), NULL, NULL, true, // enable keystore encryption + false, // force enable pre-commit GU avoidance "fake_invalidator_client_id")); context_->set_routing_info(routing_info_); context_->set_notifications_enabled(true); diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc index 8ebbff1..8005459 100644 --- a/sync/engine/syncer.cc +++ b/sync/engine/syncer.cc @@ -64,14 +64,17 @@ bool Syncer::NormalSyncShare(ModelTypeSet request_types, SyncSession* session) { HandleCycleBegin(session); VLOG(1) << "Downloading types " << ModelTypeSetToString(request_types); - if (!DownloadAndApplyUpdates( - session, - base::Bind(&NormalDownloadUpdates, - session, - kCreateMobileBookmarksFolder, - request_types, - base::ConstRef(nudge_tracker)))) { - return HandleCycleEnd(session); + if (nudge_tracker.IsGetUpdatesRequired() || + session->context()->ShouldFetchUpdatesBeforeCommit()) { + if (!DownloadAndApplyUpdates( + session, + base::Bind(&NormalDownloadUpdates, + session, + kCreateMobileBookmarksFolder, + request_types, + base::ConstRef(nudge_tracker)))) { + return HandleCycleEnd(session); + } } VLOG(1) << "Committing from types " << ModelTypeSetToString(request_types); diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index 61f7f9b..a2ccccf 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -239,6 +239,7 @@ class SyncerTest : public testing::Test, &extensions_activity_monitor_, listeners, NULL, &traffic_recorder_, true, // enable keystore encryption + false, // force enable pre-commit GU avoidance experiment "fake_invalidator_client_id")); context_->set_routing_info(routing_info); syncer_ = new Syncer(); |