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

Unified Diff: chrome/browser/sync/sessions/session_state.cc

Issue 9305001: sync: Remove the remaining conflict sets code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Additional comments Created 8 years, 11 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
Index: chrome/browser/sync/sessions/session_state.cc
diff --git a/chrome/browser/sync/sessions/session_state.cc b/chrome/browser/sync/sessions/session_state.cc
index d9392f2bfa4c667ffef9090cf31d9d33b1da7d11..67eaf4c01ca66bffbc0b9166d9296c6a0a04fd04 100644
--- a/chrome/browser/sync/sessions/session_state.cc
+++ b/chrome/browser/sync/sessions/session_state.cc
@@ -187,51 +187,10 @@ std::string SyncSessionSnapshot::ToString() const {
ConflictProgress::ConflictProgress(bool* dirty_flag) : dirty_(dirty_flag) {}
ConflictProgress::~ConflictProgress() {
- CleanupSets();
}
bool ConflictProgress::HasSimpleConflictItem(const syncable::Id& id) const {
- return conflicting_item_ids_.count(id) > 0 &&
- (IdToConflictSetFind(id) == IdToConflictSetEnd());
-}
-
-IdToConflictSetMap::const_iterator ConflictProgress::IdToConflictSetFind(
- const syncable::Id& the_id) const {
- return id_to_conflict_set_.find(the_id);
-}
-
-IdToConflictSetMap::const_iterator
-ConflictProgress::IdToConflictSetBegin() const {
- return id_to_conflict_set_.begin();
-}
-
-IdToConflictSetMap::const_iterator
-ConflictProgress::IdToConflictSetEnd() const {
- return id_to_conflict_set_.end();
-}
-
-IdToConflictSetMap::size_type ConflictProgress::IdToConflictSetSize() const {
- return id_to_conflict_set_.size();
-}
-
-const ConflictSet* ConflictProgress::IdToConflictSetGet(
- const syncable::Id& the_id) {
- return id_to_conflict_set_[the_id];
-}
-
-std::set<ConflictSet*>::const_iterator
-ConflictProgress::ConflictSetsBegin() const {
- return conflict_sets_.begin();
-}
-
-std::set<ConflictSet*>::const_iterator
-ConflictProgress::ConflictSetsEnd() const {
- return conflict_sets_.end();
-}
-
-std::set<ConflictSet*>::size_type
-ConflictProgress::ConflictSetsSize() const {
- return conflict_sets_.size();
+ return conflicting_item_ids_.count(id) > 0;
}
std::set<syncable::Id>::const_iterator
@@ -264,66 +223,14 @@ void ConflictProgress::AddNonblockingConflictingItemById(
*dirty_ = true;
}
-void ConflictProgress::EraseNonblockingConflictingItemById(
+void ConflictProgress::AddHierarchyConflictingItemById(
const syncable::Id& the_id) {
- int items_erased = nonblocking_conflicting_item_ids_.erase(the_id);
- if (items_erased != 0)
+ std::pair<std::set<syncable::Id>::iterator, bool> ret =
+ hierarchy_conflicting_item_ids_.insert(the_id);
+ if (ret.second)
*dirty_ = true;
}
-void ConflictProgress::MergeSets(const syncable::Id& id1,
- const syncable::Id& id2) {
- // There are no single item sets, we just leave those entries == 0
- vector<syncable::Id>* set1 = id_to_conflict_set_[id1];
- vector<syncable::Id>* set2 = id_to_conflict_set_[id2];
- vector<syncable::Id>* rv = 0;
- if (0 == set1 && 0 == set2) {
- // Neither item currently has a set so we build one.
- rv = new vector<syncable::Id>();
- rv->push_back(id1);
- if (id1 != id2) {
- rv->push_back(id2);
- } else {
- LOG(WARNING) << "[BUG] Attempting to merge two identical conflict ids.";
- }
- conflict_sets_.insert(rv);
- } else if (0 == set1) {
- // Add the item to the existing set.
- rv = set2;
- rv->push_back(id1);
- } else if (0 == set2) {
- // Add the item to the existing set.
- rv = set1;
- rv->push_back(id2);
- } else if (set1 == set2) {
- // It's the same set already.
- return;
- } else {
- // Merge the two sets.
- rv = set1;
- // Point all the second sets id's back to the first.
- vector<syncable::Id>::iterator i;
- for (i = set2->begin() ; i != set2->end() ; ++i) {
- id_to_conflict_set_[*i] = rv;
- }
- // Copy the second set to the first.
- rv->insert(rv->end(), set2->begin(), set2->end());
- conflict_sets_.erase(set2);
- delete set2;
- }
- id_to_conflict_set_[id1] = id_to_conflict_set_[id2] = rv;
-}
-
-void ConflictProgress::CleanupSets() {
- // Clean up all the sets.
- set<ConflictSet*>::iterator i;
- for (i = conflict_sets_.begin(); i != conflict_sets_.end(); i++) {
- delete *i;
- }
- conflict_sets_.clear();
- id_to_conflict_set_.clear();
-}
-
UpdateProgress::UpdateProgress() {}
UpdateProgress::~UpdateProgress() {}

Powered by Google App Engine
This is Rietveld 408576698