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

Unified Diff: sync/sessions/ordered_commit_set.cc

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor loop again, add comments + more Created 8 years, 7 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: sync/sessions/ordered_commit_set.cc
diff --git a/sync/sessions/ordered_commit_set.cc b/sync/sessions/ordered_commit_set.cc
index 51a354eb19e31813b2e6767be5107483c76d1489..c3fc5d0d627f61c4b8181dc070fb1b242a56d717 100644
--- a/sync/sessions/ordered_commit_set.cc
+++ b/sync/sessions/ordered_commit_set.cc
@@ -31,8 +31,15 @@ void OrderedCommitSet::AddCommitItem(const int64 metahandle,
}
}
+const OrderedCommitSet::Projection& OrderedCommitSet::GetCommitIdProjection(
+ browser_sync::ModelSafeGroup group) const {
+ Projections::const_iterator i = projections_.find(group);
+ DCHECK(i != projections_.end());
+ return i->second;
+}
+
void OrderedCommitSet::Append(const OrderedCommitSet& other) {
- for (int i = 0; i < other.Size(); ++i) {
+ for (size_t i = 0; i < other.Size(); ++i) {
CommitItem item = other.GetCommitItemAt(i);
AddCommitItem(item.meta, item.id, item.group);
}
@@ -71,8 +78,19 @@ 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) {
+ it->second.clear();
+ }
+ types_.clear();
+}
+
OrderedCommitSet::CommitItem OrderedCommitSet::GetCommitItemAt(
- const int position) const {
+ const size_t position) const {
DCHECK(position < Size());
CommitItem return_item = {metahandle_order_[position],
commit_ids_[position],

Powered by Google App Engine
This is Rietveld 408576698