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

Side by Side Diff: chrome/browser/sync/engine/store_timestamps_command.cc

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/model_type.h"
10 #include "chrome/browser/sync/syncable/syncable.h"
11
12 namespace browser_sync {
13
14 StoreTimestampsCommand::StoreTimestampsCommand() {}
15 StoreTimestampsCommand::~StoreTimestampsCommand() {}
16
17 SyncerError StoreTimestampsCommand::ExecuteImpl(
18 sessions::SyncSession* session) {
19 syncable::Directory* dir = session->context()->directory();
20
21 const GetUpdatesResponse& updates =
22 session->status_controller().updates_response().get_updates();
23
24 sessions::StatusController* status = session->mutable_status_controller();
25
26 // Update the progress marker tokens from the server result. If a marker
27 // was omitted for any one type, that indicates no change from the previous
28 // state.
29 syncable::ModelTypeSet forward_progress_types;
30 for (int i = 0; i < updates.new_progress_marker_size(); ++i) {
31 syncable::ModelType model =
32 syncable::GetModelTypeFromSpecificsFieldNumber(
33 updates.new_progress_marker(i).data_type_id());
34 if (model == syncable::UNSPECIFIED || model == syncable::TOP_LEVEL_FOLDER) {
35 NOTREACHED() << "Unintelligible server response.";
36 continue;
37 }
38 forward_progress_types.Put(model);
39 dir->SetDownloadProgress(model, updates.new_progress_marker(i));
40 }
41 DCHECK(!forward_progress_types.Empty() ||
42 updates.changes_remaining() == 0);
43 if (VLOG_IS_ON(1)) {
44 DVLOG_IF(1, !forward_progress_types.Empty())
45 << "Get Updates got new progress marker for types: "
46 << syncable::ModelTypeSetToString(forward_progress_types)
47 << " out of possible: "
48 << syncable::ModelTypeSetToString(status->updates_request_types());
49 }
50 if (updates.has_changes_remaining()) {
51 int64 changes_left = updates.changes_remaining();
52 DVLOG(1) << "Changes remaining: " << changes_left;
53 status->set_num_server_changes_remaining(changes_left);
54 }
55
56 return SYNCER_OK;
57 }
58
59 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/store_timestamps_command.h ('k') | chrome/browser/sync/engine/sync_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698