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

Unified Diff: sync/sessions/ordered_commit_set.cc

Issue 25638003: sync: Implement per-type commit interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix win compile Created 7 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/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
deleted file mode 100644
index fde95d7f30ca148b6c8ba76d56f1eface3e9c37c..0000000000000000000000000000000000000000
--- a/sync/sessions/ordered_commit_set.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sync/sessions/ordered_commit_set.h"
-
-#include <algorithm>
-
-#include "base/logging.h"
-
-namespace syncer {
-namespace sessions {
-
-OrderedCommitSet::OrderedCommitSet() {}
-
-OrderedCommitSet::~OrderedCommitSet() {}
-
-void OrderedCommitSet::AddCommitItem(const int64 metahandle,
- ModelType type) {
- if (!HaveCommitItem(metahandle)) {
- inserted_metahandles_.insert(metahandle);
- metahandle_order_.push_back(metahandle);
- 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);
- }
-}
-
-void OrderedCommitSet::Append(const OrderedCommitSet& other) {
- for (size_t i = 0; i < other.Size(); ++i) {
- CommitItem item = other.GetCommitItemAt(i);
- 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.group);
- }
-}
-
-void OrderedCommitSet::Truncate(size_t max_size) {
- if (max_size < metahandle_order_.size()) {
- for (size_t i = max_size; i < metahandle_order_.size(); ++i) {
- inserted_metahandles_.erase(metahandle_order_[i]);
- }
-
- metahandle_order_.resize(max_size);
- types_.resize(max_size);
- }
-}
-
-void OrderedCommitSet::Clear() {
- inserted_metahandles_.clear();
- metahandle_order_.clear();
- types_.clear();
- types_in_list_.Clear();
-}
-
-OrderedCommitSet::CommitItem OrderedCommitSet::GetCommitItemAt(
- const size_t position) const {
- DCHECK(position < Size());
- CommitItem return_item = {metahandle_order_[position],
- types_[position]};
- return return_item;
-}
-
-bool OrderedCommitSet::HasBookmarkCommitId() const {
- for (size_t i = 0; i < types_.size(); i++) {
- if (types_[i] == BOOKMARKS)
- return true;
- }
- return false;
-}
-
-void OrderedCommitSet::operator=(const OrderedCommitSet& other) {
- inserted_metahandles_ = other.inserted_metahandles_;
- metahandle_order_ = other.metahandle_order_;
- types_ = other.types_;
-}
-
-} // namespace sessions
-} // namespace syncer
-
« 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