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

Side by Side Diff: sync/sessions/sync_session.cc

Issue 11091009: sync: Merge {Verify,Process}UpdatesCommand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Amend comment Created 8 years, 2 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
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sync.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/sessions/sync_session.h" 5 #include "sync/sessions/sync_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 enabled_groups.begin(); it != enabled_groups.end(); ++it) { 215 enabled_groups.begin(); it != enabled_groups.end(); ++it) {
216 const std::set<syncable::Id>* ids = 216 const std::set<syncable::Id>* ids =
217 status_controller_->GetUnrestrictedSimpleConflictIds(*it); 217 status_controller_->GetUnrestrictedSimpleConflictIds(*it);
218 if (ids && ids->size() > 0) { 218 if (ids && ids->size() > 0) {
219 enabled_groups_with_conflicts.insert(*it); 219 enabled_groups_with_conflicts.insert(*it);
220 } 220 }
221 } 221 }
222 return enabled_groups_with_conflicts; 222 return enabled_groups_with_conflicts;
223 } 223 }
224 224
225 std::set<ModelSafeGroup>
226 SyncSession::GetEnabledGroupsWithVerifiedUpdates() const {
227 const std::set<ModelSafeGroup>& enabled_groups = GetEnabledGroups();
228 std::set<ModelSafeGroup> enabled_groups_with_verified_updates;
229 for (std::set<ModelSafeGroup>::const_iterator it =
230 enabled_groups.begin(); it != enabled_groups.end(); ++it) {
231 const UpdateProgress* update_progress =
232 status_controller_->GetUnrestrictedUpdateProgress(*it);
233 if (update_progress &&
234 (update_progress->VerifiedUpdatesBegin() !=
235 update_progress->VerifiedUpdatesEnd())) {
236 enabled_groups_with_verified_updates.insert(*it);
237 }
238 }
239
240 return enabled_groups_with_verified_updates;
241 }
242
243 namespace { 225 namespace {
244 226
245 // Returns false iff one of the command results had an error. 227 // Returns false iff one of the command results had an error.
246 bool HadErrors(const ModelNeutralState& state) { 228 bool HadErrors(const ModelNeutralState& state) {
247 const bool get_key_error = SyncerErrorIsError(state.last_get_key_result); 229 const bool get_key_error = SyncerErrorIsError(state.last_get_key_result);
248 const bool download_updates_error = 230 const bool download_updates_error =
249 SyncerErrorIsError(state.last_download_updates_result); 231 SyncerErrorIsError(state.last_download_updates_result);
250 const bool commit_error = SyncerErrorIsError(state.commit_result); 232 const bool commit_error = SyncerErrorIsError(state.commit_result);
251 return get_key_error || download_updates_error || commit_error; 233 return get_key_error || download_updates_error || commit_error;
252 } 234 }
(...skipping 13 matching lines...) Expand all
266 // with the server. Therefore, we verify no errors and at least one SYNCER_OK. 248 // with the server. Therefore, we verify no errors and at least one SYNCER_OK.
267 return reached_server && !HadErrors(state); 249 return reached_server && !HadErrors(state);
268 } 250 }
269 251
270 void SyncSession::SetFinished() { 252 void SyncSession::SetFinished() {
271 finished_ = true; 253 finished_ = true;
272 } 254 }
273 255
274 } // namespace sessions 256 } // namespace sessions
275 } // namespace syncer 257 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698