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

Unified Diff: sync/engine/update_applicator.cc

Issue 11190013: sync: Remove UpdateProgress and related code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting improvements 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/update_applicator.h ('k') | sync/sessions/session_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/update_applicator.cc
diff --git a/sync/engine/update_applicator.cc b/sync/engine/update_applicator.cc
index cb09fc75b5711ee2f8e3166fae2e22e280afc4e5..541b68ca95d9839e6dfb61d1d32636603fa1fb78 100644
--- a/sync/engine/update_applicator.cc
+++ b/sync/engine/update_applicator.cc
@@ -25,8 +25,7 @@ UpdateApplicator::UpdateApplicator(Cryptographer* cryptographer,
ModelSafeGroup group_filter)
: cryptographer_(cryptographer),
group_filter_(group_filter),
- routing_info_(routes),
- application_results_() {
+ routing_info_(routes) {
}
UpdateApplicator::~UpdateApplicator() {
@@ -48,6 +47,9 @@ void UpdateApplicator::AttemptApplications(
const std::vector<int64>& handles,
sessions::StatusController* status) {
std::vector<int64> to_apply = handles;
+ std::set<syncable::Id>* simple_conflict_ids =
+ status->mutable_simple_conflict_ids();
+
DVLOG(1) << "UpdateApplicator running over " << to_apply.size() << " items.";
while (!to_apply.empty()) {
std::vector<int64> to_reapply;
@@ -64,18 +66,15 @@ void UpdateApplicator::AttemptApplications(
switch (result) {
case SUCCESS:
- application_results_.AddSuccess(entry.Get(ID));
status->increment_num_updates_applied();
break;
case CONFLICT_SIMPLE:
- application_results_.AddSimpleConflict(entry.Get(ID));
+ simple_conflict_ids->insert(entry.Get(ID));
break;
case CONFLICT_ENCRYPTION:
- application_results_.AddEncryptionConflict(entry.Get(ID));
status->increment_num_encryption_conflicts();
break;
case CONFLICT_HIERARCHY:
- application_results_.AddHierarchyConflict(entry.Get(ID));
// The decision to classify these as hierarchy conflcits is tentative.
// If we make any progress this round, we'll clear the hierarchy
// conflict count and attempt to reapply these updates.
@@ -96,7 +95,6 @@ void UpdateApplicator::AttemptApplications(
// We made some progress, so prepare for what might be another iteration.
// If everything went well, to_reapply will be empty and we'll break out on
// the while condition.
- application_results_.ClearHierarchyConflicts();
to_apply.swap(to_reapply);
to_reapply.clear();
}
@@ -121,61 +119,4 @@ bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) {
return false;
}
-void UpdateApplicator::SaveProgressIntoSessionState(
- std::set<syncable::Id>* simple_conflict_ids,
- sessions::UpdateProgress* update_progress) {
- application_results_.SaveProgress(simple_conflict_ids, update_progress);
-}
-
-UpdateApplicator::ResultTracker::ResultTracker() {
-}
-
-UpdateApplicator::ResultTracker::~ResultTracker() {
-}
-
-void UpdateApplicator::ResultTracker::AddSimpleConflict(syncable::Id id) {
- conflicting_ids_.insert(id);
-}
-
-void UpdateApplicator::ResultTracker::AddEncryptionConflict(syncable::Id id) {
- encryption_conflict_ids_.insert(id);
-}
-
-void UpdateApplicator::ResultTracker::AddHierarchyConflict(syncable::Id id) {
- hierarchy_conflict_ids_.insert(id);
-}
-
-void UpdateApplicator::ResultTracker::AddSuccess(syncable::Id id) {
- successful_ids_.insert(id);
-}
-
-void UpdateApplicator::ResultTracker::SaveProgress(
- std::set<syncable::Id>* simple_conflict_ids,
- sessions::UpdateProgress* update_progress) {
- std::set<syncable::Id>::const_iterator i;
- *simple_conflict_ids = conflicting_ids_;
- for (i = conflicting_ids_.begin(); i != conflicting_ids_.end(); ++i) {
- update_progress->AddAppliedUpdate(CONFLICT_SIMPLE, *i);
- }
- for (i = encryption_conflict_ids_.begin();
- i != encryption_conflict_ids_.end(); ++i) {
- update_progress->AddAppliedUpdate(CONFLICT_ENCRYPTION, *i);
- }
- for (i = hierarchy_conflict_ids_.begin();
- i != hierarchy_conflict_ids_.end(); ++i) {
- update_progress->AddAppliedUpdate(CONFLICT_HIERARCHY, *i);
- }
- for (i = successful_ids_.begin(); i != successful_ids_.end(); ++i) {
- update_progress->AddAppliedUpdate(SUCCESS, *i);
- }
-}
-
-void UpdateApplicator::ResultTracker::ClearHierarchyConflicts() {
- hierarchy_conflict_ids_.clear();
-}
-
-bool UpdateApplicator::ResultTracker::no_conflicts() const {
- return conflicting_ids_.empty();
-}
-
} // namespace syncer
« no previous file with comments | « sync/engine/update_applicator.h ('k') | sync/sessions/session_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698