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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/engine/store_timestamps_command.h"
6
7 #include "chrome/browser/sync/sessions/status_controller.h"
8 #include "chrome/browser/sync/sessions/sync_session.h"
9 #include "chrome/browser/sync/syncable/directory_manager.h"
10 #include "chrome/browser/sync/syncable/syncable.h"
11
12 namespace browser_sync {
13
14 StoreTimestampsCommand::StoreTimestampsCommand() {}
15 StoreTimestampsCommand::~StoreTimestampsCommand() {}
16
17 void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) {
18 syncable::ScopedDirLookup dir(session->context()->directory_manager(),
19 session->context()->account_name());
20
21 if (!dir.good()) {
22 LOG(ERROR) << "Scoped dir lookup failed!";
23 return;
24 }
25
26 const GetUpdatesResponse& updates =
27 session->status_controller()->updates_response().get_updates();
28
29 sessions::StatusController* status = session->status_controller();
30 if (updates.has_changes_remaining()) {
31 int64 changes_left = updates.changes_remaining();
32 LOG(INFO) << "Changes remaining:" << changes_left;
33 status->set_num_server_changes_remaining(changes_left);
34 }
35
36 if (updates.has_new_timestamp()) {
37 LOG(INFO) << "Get Updates got new timestamp: " << updates.new_timestamp();
38 if (updates.new_timestamp() > dir->last_download_timestamp()) {
39 dir->set_last_download_timestamp(updates.new_timestamp());
40 }
41 }
42
43 // TODO(tim): Related to bug 30665, the Directory needs last sync timestamp
44 // per data type. Until then, use UNSPECIFIED.
45 status->set_current_sync_timestamp(syncable::UNSPECIFIED,
46 dir->last_download_timestamp());
47 }
48
49 } // namespace browser_sync
OLDNEW
« 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