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

Side by Side Diff: chrome/browser/sync/sessions/ordered_commit_set.cc

Issue 8922015: [Sync] Don't commit items with predecessors/parents in conflict. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/sessions/ordered_commit_set.h" 5 #include "chrome/browser/sync/sessions/ordered_commit_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 13 matching lines...) Expand all
24 if (!HaveCommitItem(metahandle)) { 24 if (!HaveCommitItem(metahandle)) {
25 inserted_metahandles_.insert(metahandle); 25 inserted_metahandles_.insert(metahandle);
26 metahandle_order_.push_back(metahandle); 26 metahandle_order_.push_back(metahandle);
27 commit_ids_.push_back(commit_id); 27 commit_ids_.push_back(commit_id);
28 projections_[GetGroupForModelType(type, routes_)].push_back( 28 projections_[GetGroupForModelType(type, routes_)].push_back(
29 commit_ids_.size() - 1); 29 commit_ids_.size() - 1);
30 types_.push_back(type); 30 types_.push_back(type);
31 } 31 }
32 } 32 }
33 33
34 void OrderedCommitSet::Clear() {
35 inserted_metahandles_.clear();
36 metahandle_order_.clear();
37 commit_ids_.clear();
38 projections_.clear();
39 types_.clear();
40 }
41
34 void OrderedCommitSet::AppendReverse(const OrderedCommitSet& other) { 42 void OrderedCommitSet::AppendReverse(const OrderedCommitSet& other) {
35 for (int i = other.Size() - 1; i >= 0; i--) { 43 for (int i = other.Size() - 1; i >= 0; i--) {
36 CommitItem item = other.GetCommitItemAt(i); 44 CommitItem item = other.GetCommitItemAt(i);
37 AddCommitItem(item.meta, item.id, item.group); 45 AddCommitItem(item.meta, item.id, item.group);
38 } 46 }
39 } 47 }
40 48
41 void OrderedCommitSet::Truncate(size_t max_size) { 49 void OrderedCommitSet::Truncate(size_t max_size) {
42 if (max_size < metahandle_order_.size()) { 50 if (max_size < metahandle_order_.size()) {
43 for (size_t i = max_size; i < metahandle_order_.size(); ++i) { 51 for (size_t i = max_size; i < metahandle_order_.size(); ++i) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 commit_ids_ = other.commit_ids_; 102 commit_ids_ = other.commit_ids_;
95 metahandle_order_ = other.metahandle_order_; 103 metahandle_order_ = other.metahandle_order_;
96 projections_ = other.projections_; 104 projections_ = other.projections_;
97 types_ = other.types_; 105 types_ = other.types_;
98 routes_ = other.routes_; 106 routes_ = other.routes_;
99 } 107 }
100 108
101 } // namespace sessions 109 } // namespace sessions
102 } // namespace browser_sync 110 } // namespace browser_sync
103 111
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698