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

Side by Side Diff: sync/engine/resolve_conflicts_command.cc

Issue 10559104: sync: Process 'control' data separately (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename, cleanup, fix tests Created 8 years, 6 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/engine/model_changing_syncer_command_unittest.cc ('k') | sync/engine/sync_scheduler.cc » ('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/engine/resolve_conflicts_command.h" 5 #include "sync/engine/resolve_conflicts_command.h"
6 6
7 #include "sync/engine/conflict_resolver.h" 7 #include "sync/engine/conflict_resolver.h"
8 #include "sync/sessions/session_state.h" 8 #include "sync/sessions/session_state.h"
9 #include "sync/sessions/sync_session.h" 9 #include "sync/sessions/sync_session.h"
10 #include "sync/syncable/directory.h" 10 #include "sync/syncable/directory.h"
11 #include "sync/syncable/write_transaction.h" 11 #include "sync/syncable/write_transaction.h"
12 12
13 namespace csync { 13 namespace csync {
14 14
15 ResolveConflictsCommand::ResolveConflictsCommand() {} 15 ResolveConflictsCommand::ResolveConflictsCommand() {}
16 ResolveConflictsCommand::~ResolveConflictsCommand() {} 16 ResolveConflictsCommand::~ResolveConflictsCommand() {}
17 17
18 std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange( 18 std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange(
19 const sessions::SyncSession& session) const { 19 const sessions::SyncSession& session) const {
20 return session.GetEnabledGroupsWithConflicts(); 20 std::set<ModelSafeGroup> groups_with_conflicts =
21 session.GetEnabledGroupsWithConflicts();
22
23 // GROUP_CONTROL conflicts are not handled by this command.
24 groups_with_conflicts.erase(GROUP_CONTROL);
25
26 return groups_with_conflicts;
21 } 27 }
22 28
23 SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl( 29 SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl(
24 sessions::SyncSession* session) { 30 sessions::SyncSession* session) {
25 ConflictResolver* resolver = session->context()->resolver(); 31 ConflictResolver* resolver = session->context()->resolver();
26 DCHECK(resolver); 32 DCHECK(resolver);
27 33
28 syncable::Directory* dir = session->context()->directory(); 34 syncable::Directory* dir = session->context()->directory();
29 sessions::StatusController* status = session->mutable_status_controller(); 35 sessions::StatusController* status = session->mutable_status_controller();
30 const sessions::ConflictProgress* progress = status->conflict_progress(); 36 const sessions::ConflictProgress* progress = status->conflict_progress();
31 if (!progress) 37 if (!progress)
32 return SYNCER_OK; // Nothing to do. 38 return SYNCER_OK; // Nothing to do.
33 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); 39 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir);
34 const Cryptographer* cryptographer = dir->GetCryptographer(&trans); 40 const Cryptographer* cryptographer = dir->GetCryptographer(&trans);
35 status->update_conflicts_resolved( 41 status->update_conflicts_resolved(
36 resolver->ResolveConflicts(&trans, cryptographer, *progress, status)); 42 resolver->ResolveConflicts(&trans, cryptographer, *progress, status));
37 43
38 return SYNCER_OK; 44 return SYNCER_OK;
39 } 45 }
40 46
41 } // namespace csync 47 } // namespace csync
OLDNEW
« no previous file with comments | « sync/engine/model_changing_syncer_command_unittest.cc ('k') | sync/engine/sync_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698