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

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

Issue 1161006: Make it clear what last_sync_timestamp actually tracks. Update (Closed)
Patch Set: Undo accidental patch-juggling mistake. Created 10 years, 9 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
« no previous file with comments | « chrome/browser/sync/engine/store_timestamps_command.h ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100755
index 0000000000000000000000000000000000000000..1625e82ec4b4e5cf003124f0487451c2d9dd31d0
--- /dev/null
+++ b/chrome/browser/sync/engine/store_timestamps_command.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/engine/store_timestamps_command.h"
+
+#include "chrome/browser/sync/sessions/status_controller.h"
+#include "chrome/browser/sync/sessions/sync_session.h"
+#include "chrome/browser/sync/syncable/directory_manager.h"
+#include "chrome/browser/sync/syncable/syncable.h"
+
+namespace browser_sync {
+
+StoreTimestampsCommand::StoreTimestampsCommand() {}
+StoreTimestampsCommand::~StoreTimestampsCommand() {}
+
+void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) {
+ syncable::ScopedDirLookup dir(session->context()->directory_manager(),
+ session->context()->account_name());
+
+ if (!dir.good()) {
+ LOG(ERROR) << "Scoped dir lookup failed!";
+ return;
+ }
+
+ const GetUpdatesResponse& updates =
+ session->status_controller()->updates_response().get_updates();
+
+ sessions::StatusController* status = session->status_controller();
+ if (updates.has_changes_remaining()) {
+ int64 changes_left = updates.changes_remaining();
+ LOG(INFO) << "Changes remaining:" << changes_left;
+ status->set_num_server_changes_remaining(changes_left);
+ }
+
+ if (updates.has_new_timestamp()) {
+ LOG(INFO) << "Get Updates got new timestamp: " << updates.new_timestamp();
+ if (updates.new_timestamp() > dir->last_download_timestamp()) {
+ dir->set_last_download_timestamp(updates.new_timestamp());
+ }
+ }
+
+ // TODO(tim): Related to bug 30665, the Directory needs last sync timestamp
+ // per data type. Until then, use UNSPECIFIED.
+ status->set_current_sync_timestamp(syncable::UNSPECIFIED,
+ dir->last_download_timestamp());
+}
+
+} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/engine/store_timestamps_command.h ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698