Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: chrome/browser/sync/engine/store_timestamps_command.cc

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tim's fixes Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/store_timestamps_command.cc
diff --git a/chrome/browser/sync/engine/store_timestamps_command.cc b/chrome/browser/sync/engine/store_timestamps_command.cc
index 8cf8f581ed6d5647b75cbeb9927935b004245729..a063bf4adb20e771a9945b2d3ae5da03622f2f25 100644
--- a/chrome/browser/sync/engine/store_timestamps_command.cc
+++ b/chrome/browser/sync/engine/store_timestamps_command.cc
@@ -28,28 +28,35 @@ void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) {
session->status_controller()->updates_response().get_updates();
sessions::StatusController* status = session->status_controller();
+
+ // Update the progress marker tokens from the server result. If a marker
+ // was omitted for any one type, that indicates no change from the previous
+ // state.
+ syncable::ModelTypeBitSet forward_progress_types;
+ for (int i = 0; i < updates.new_progress_marker_size(); ++i) {
+ syncable::ModelType model =
+ syncable::GetModelTypeFromExtensionFieldNumber(
+ updates.new_progress_marker(i).data_type_id());
+ if (model == syncable::UNSPECIFIED || model == syncable::TOP_LEVEL_FOLDER) {
+ NOTREACHED() << "Unintelligible server response.";
+ continue;
+ }
+ forward_progress_types[model] = true;
+ dir->SetDownloadProgress(model, updates.new_progress_marker(i));
+ }
+ DCHECK(forward_progress_types.any() ||
+ updates.changes_remaining() == 0);
+ if (VLOG_IS_ON(1)) {
+ VLOG_IF(1, forward_progress_types.any())
+ << "Get Updates got new progress marker for types: "
+ << forward_progress_types.to_string() << " out of possible: "
+ << status->updates_request_types().to_string();
+ }
if (updates.has_changes_remaining()) {
int64 changes_left = updates.changes_remaining();
- VLOG(1) << "Changes remaining:" << changes_left;
+ VLOG(1) << "Changes remaining: " << changes_left;
status->set_num_server_changes_remaining(changes_left);
}
-
- VLOG_IF(1, updates.has_new_timestamp())
- << "Get Updates got new timestamp: " << updates.new_timestamp()
- << " for type mask: "
- << status->updates_request_parameters().data_types.to_string();
-
- // Update the saved download timestamp for any items we fetched.
- for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) {
- syncable::ModelType model = syncable::ModelTypeFromInt(i);
- if (status->updates_request_parameters().data_types[i] &&
- updates.has_new_timestamp() &&
- (updates.new_timestamp() > dir->last_download_timestamp(model))) {
- dir->set_last_download_timestamp(model, updates.new_timestamp());
- }
- status->set_current_download_timestamp(model,
- dir->last_download_timestamp(model));
- }
}
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/engine/download_updates_command_unittest.cc ('k') | chrome/browser/sync/engine/syncapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698