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

Unified Diff: sync/sessions/ordered_commit_set.cc

Issue 23694004: sync: Remove IDs from OrderedCommitSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/sessions/ordered_commit_set.h ('k') | sync/sessions/ordered_commit_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/ordered_commit_set.cc
diff --git a/sync/sessions/ordered_commit_set.cc b/sync/sessions/ordered_commit_set.cc
index 842a0e908fc5e78e2021ae156711ae0e0549cc38..3bbddb9c289db5967958afd5b93d10554d72591a 100644
--- a/sync/sessions/ordered_commit_set.cc
+++ b/sync/sessions/ordered_commit_set.cc
@@ -18,19 +18,26 @@ OrderedCommitSet::OrderedCommitSet(const ModelSafeRoutingInfo& routes)
OrderedCommitSet::~OrderedCommitSet() {}
void OrderedCommitSet::AddCommitItem(const int64 metahandle,
- const syncable::Id& commit_id,
ModelType type) {
if (!HaveCommitItem(metahandle)) {
inserted_metahandles_.insert(metahandle);
metahandle_order_.push_back(metahandle);
- commit_ids_.push_back(commit_id);
projections_[GetGroupForModelType(type, routes_)].push_back(
- commit_ids_.size() - 1);
+ inserted_metahandles_.size() - 1);
types_.push_back(type);
types_in_list_.Put(type);
}
}
+void OrderedCommitSet::AddCommitItems(
+ const std::vector<int64> metahandles,
+ ModelType type) {
+ for (std::vector<int64>::const_iterator it = metahandles.begin();
+ it != metahandles.end(); ++it) {
+ AddCommitItem(*it, type);
+ }
+}
+
const OrderedCommitSet::Projection& OrderedCommitSet::GetCommitIdProjection(
ModelSafeGroup group) const {
Projections::const_iterator i = projections_.find(group);
@@ -41,14 +48,14 @@ const OrderedCommitSet::Projection& OrderedCommitSet::GetCommitIdProjection(
void OrderedCommitSet::Append(const OrderedCommitSet& other) {
for (size_t i = 0; i < other.Size(); ++i) {
CommitItem item = other.GetCommitItemAt(i);
- AddCommitItem(item.meta, item.id, item.group);
+ AddCommitItem(item.meta, item.group);
}
}
void OrderedCommitSet::AppendReverse(const OrderedCommitSet& other) {
for (int i = other.Size() - 1; i >= 0; i--) {
CommitItem item = other.GetCommitItemAt(i);
- AddCommitItem(item.meta, item.id, item.group);
+ AddCommitItem(item.meta, item.group);
}
}
@@ -72,7 +79,6 @@ void OrderedCommitSet::Truncate(size_t max_size) {
if (element != p.end())
p.erase(element, p.end());
}
- commit_ids_.resize(max_size);
metahandle_order_.resize(max_size);
types_.resize(max_size);
}
@@ -80,7 +86,6 @@ void OrderedCommitSet::Truncate(size_t max_size) {
void OrderedCommitSet::Clear() {
inserted_metahandles_.clear();
- commit_ids_.clear();
metahandle_order_.clear();
for (Projections::iterator it = projections_.begin();
it != projections_.end(); ++it) {
@@ -94,7 +99,6 @@ OrderedCommitSet::CommitItem OrderedCommitSet::GetCommitItemAt(
const size_t position) const {
DCHECK(position < Size());
CommitItem return_item = {metahandle_order_[position],
- commit_ids_[position],
types_[position]};
return return_item;
}
@@ -116,7 +120,6 @@ bool OrderedCommitSet::HasBookmarkCommitId() const {
void OrderedCommitSet::operator=(const OrderedCommitSet& other) {
inserted_metahandles_ = other.inserted_metahandles_;
- commit_ids_ = other.commit_ids_;
metahandle_order_ = other.metahandle_order_;
projections_ = other.projections_;
types_ = other.types_;
« no previous file with comments | « sync/sessions/ordered_commit_set.h ('k') | sync/sessions/ordered_commit_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698