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

Unified Diff: sync/engine/apply_updates_command.cc

Issue 10933075: FYI: Remove PerModelSafeGroupState + move ConflictResolution (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/all_status.cc ('k') | sync/engine/apply_updates_command_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « sync/engine/all_status.cc ('k') | sync/engine/apply_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698