| Index: sync/engine/apply_updates_command.cc
|
| diff --git a/sync/engine/apply_updates_command.cc b/sync/engine/apply_updates_command.cc
|
| index 7d4e72ec9290d063692d741e6a1fd037c1e40b52..ace48c76e2c22c1c27f8a667eea823ada40d5a2a 100644
|
| --- a/sync/engine/apply_updates_command.cc
|
| +++ b/sync/engine/apply_updates_command.cc
|
| @@ -5,6 +5,7 @@
|
| #include "sync/engine/apply_updates_command.h"
|
|
|
| #include "base/location.h"
|
| +#include "sync/engine/conflict_resolver.cc"
|
| #include "sync/engine/update_applicator.h"
|
| #include "sync/sessions/sync_session.h"
|
| #include "sync/syncable/directory.h"
|
| @@ -65,15 +66,37 @@ SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl(
|
| dir->GetUnappliedUpdateMetaHandles(
|
| &trans, server_type_restriction, &handles);
|
|
|
| + // First set of update application passes.
|
| + std::set<syncable::Id> simple_conflict_ids;
|
| UpdateApplicator applicator(
|
| - session->context()->resolver(),
|
| dir->GetCryptographer(&trans),
|
| - handles.begin(), handles.end(), session->routing_info(),
|
| + session->routing_info(),
|
| session->status_controller().group_restriction());
|
| - while (applicator.AttemptOneApplication(&trans)) {}
|
| - applicator.SaveProgressIntoSessionState(
|
| - session->mutable_status_controller()->mutable_conflict_progress(),
|
| - session->mutable_status_controller()->mutable_update_progress());
|
| + applicator.AttemptApplications(&trans, handles,
|
| + &simple_conflict_ids /* out param */);
|
| +
|
| + // Resolve all simple conflicts.
|
| + ConflictResolver resolver;
|
| + resolver.ResolveConflicts(&trans,
|
| + dir->GetCryptographer(&trans),
|
| + simple_conflict_ids,
|
| + session->mutable_status_controller());
|
| +
|
| + // Conflict resolution may have cleared the way for more applications.
|
| + // FIXME: this will cause us to double-count encryption and hierarchy
|
| + // conflicts.
|
| + handles.clear();
|
| + simple_conflict_ids.clear();
|
| + dir->GetUnappliedUpdateMetaHandles(
|
| + &trans, server_type_restriction, &handles);
|
| + applicator.AttemptApplications(&trans, handles,
|
| + &simple_conflict_ids /* out param */);
|
| +
|
| + // FIXME: This may not be correct. We ought to loop until no simple conflicts
|
| + // remain.
|
| + DCHECK(simple_conflict_ids.empty());
|
| +
|
| + applicator.SaveStats(session->mutable_status_controller());
|
|
|
| // This might be the first time we've fully completed a sync cycle, for
|
| // some subset of the currently synced datatypes.
|
|
|