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

Unified Diff: blimp/helium/version_vector.cc

Issue 2602103002: Delete blimp/helium and remove references to it from dependent targets (Closed)
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/helium/version_vector.h ('k') | blimp/helium/version_vector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/helium/version_vector.cc
diff --git a/blimp/helium/version_vector.cc b/blimp/helium/version_vector.cc
deleted file mode 100644
index d1843e586a0ddd8c8c71757a0e722656967e4267..0000000000000000000000000000000000000000
--- a/blimp/helium/version_vector.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 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 "blimp/helium/version_vector.h"
-
-#include <algorithm>
-
-#include "base/logging.h"
-
-namespace blimp {
-namespace helium {
-
-VersionVector::VersionVector() {}
-
-VersionVector::VersionVector(Revision local_revision, Revision remote_revision)
- : local_revision_(local_revision), remote_revision_(remote_revision) {}
-
-VersionVector::Comparison VersionVector::CompareTo(
- const VersionVector& other) const {
- DCHECK_GE(local_revision_, other.local_revision());
-
- if (local_revision_ == other.local_revision()) {
- if (remote_revision_ == other.remote_revision()) {
- return VersionVector::Comparison::EqualTo;
- } else if (remote_revision_ < other.remote_revision()) {
- return VersionVector::Comparison::LessThan;
- } else {
- return VersionVector::Comparison::GreaterThan;
- }
- } else {
- if (local_revision_ > other.local_revision()) {
- if (remote_revision_ == other.remote_revision()) {
- return VersionVector::Comparison::GreaterThan;
- } else {
- return VersionVector::Comparison::Conflict;
- }
- } else { // We know its not equal or greater, so its smaller
- if (remote_revision_ == other.remote_revision()) {
- return VersionVector::Comparison::LessThan;
- } else {
- LOG(FATAL) << "Local revision should always be greater or equal.";
- return VersionVector::Comparison::Conflict;
- }
- }
- }
-}
-
-VersionVector::Comparison VersionVector::CompareWithBias(
- const VersionVector& other,
- Bias bias) const {
- Comparison cmp = CompareTo(other);
- if (cmp == Comparison::Conflict) {
- if (bias == Bias::REMOTE) {
- return Comparison::LessThan;
- } else if (bias == Bias::LOCAL) {
- return Comparison::GreaterThan;
- }
- }
- return cmp;
-}
-
-VersionVector VersionVector::MergeWith(const VersionVector& other) const {
- VersionVector result(std::max(local_revision_, other.local_revision()),
- std::max(remote_revision_, other.remote_revision()));
- return result;
-}
-
-void VersionVector::IncrementLocal() {
- local_revision_++;
-}
-
-proto::VersionVectorMessage VersionVector::ToProto() const {
- proto::VersionVectorMessage result;
- result.set_local_revision(local_revision_);
- result.set_remote_revision(remote_revision_);
- return result;
-}
-
-VersionVector VersionVector::Invert() const {
- return VersionVector(remote_revision_, local_revision_);
-}
-
-} // namespace helium
-} // namespace blimp
« no previous file with comments | « blimp/helium/version_vector.h ('k') | blimp/helium/version_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698