summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 21:25:02 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-15 21:25:02 +0000
commit9d9715a7d045e052061fe8750d198d378befe99e (patch)
treef0f3c074ccc3528b62e332c31e38e5f0a49a7ac5 /chrome/browser/sync
parent116ec34886c13ba18a2f0d43f5f4b32f579389ae (diff)
downloadchromium_src-9d9715a7d045e052061fe8750d198d378befe99e.zip
chromium_src-9d9715a7d045e052061fe8750d198d378befe99e.tar.gz
chromium_src-9d9715a7d045e052061fe8750d198d378befe99e.tar.bz2
Treat "changes_remaining == 0" as a firm bound that indicates
the end of a batch. The server implementation has always been consistent with this treatment. This has the effect of eliminating a GetUpdates proximate to a commit (we do 3 total instead of 4). BUG=55279 TEST=Integration tests + Manual testing of sync with trace breakpoints. Review URL: http://codereview.chromium.org/3402003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/engine/download_updates_command.cc4
-rw-r--r--chrome/browser/sync/sessions/status_controller.cc10
2 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/sync/engine/download_updates_command.cc b/chrome/browser/sync/engine/download_updates_command.cc
index b3606fd..da88447 100644
--- a/chrome/browser/sync/engine/download_updates_command.cc
+++ b/chrome/browser/sync/engine/download_updates_command.cc
@@ -94,7 +94,9 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) {
LOG(INFO) << "GetUpdates from ts " << get_updates->from_timestamp()
<< " returned " << update_response.get_updates().entries_size()
- << " updates.";
+ << " updates and indicated "
+ << update_response.get_updates().changes_remaining()
+ << " updates left on server.";
}
void DownloadUpdatesCommand::SetRequestedTypes(
diff --git a/chrome/browser/sync/sessions/status_controller.cc b/chrome/browser/sync/sessions/status_controller.cc
index cb15468..21159d8 100644
--- a/chrome/browser/sync/sessions/status_controller.cc
+++ b/chrome/browser/sync/sessions/status_controller.cc
@@ -230,8 +230,14 @@ bool StatusController::ServerSaysNothingMoreToDownload() const {
return false;
}
}
- // The server indicates "you're up to date" by not sending a new
- // timestamp.
+ // Changes remaining is an estimate, but if it's estimated to be
+ // zero, that's firm and we don't have to ask again.
+ if (updates_response().get_updates().has_changes_remaining() &&
+ updates_response().get_updates().changes_remaining() == 0) {
+ return true;
+ }
+ // Otherwise, the server can also indicate "you're up to date"
+ // by not sending a new timestamp.
return !updates_response().get_updates().has_new_timestamp();
}