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

Unified Diff: sync/internal_api/public/base/ack_handle.cc

Issue 23441042: Refactor common invalidation framework types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move DEPS rule 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/internal_api/public/base/ack_handle.h ('k') | sync/internal_api/public/base/invalidation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/public/base/ack_handle.cc
diff --git a/sync/internal_api/public/base/invalidation.cc b/sync/internal_api/public/base/ack_handle.cc
similarity index 58%
copy from sync/internal_api/public/base/invalidation.cc
copy to sync/internal_api/public/base/ack_handle.cc
index b503d07c4afa99905a688d70eeb85c8d6d80a425..f5ddf121e3b371d75352f974a8d44cf9a73b9512 100644
--- a/sync/internal_api/public/base/invalidation.cc
+++ b/sync/internal_api/public/base/ack_handle.cc
@@ -1,8 +1,8 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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/internal_api/public/base/invalidation.h"
+#include "sync/internal_api/public/base/ack_handle.h"
#include <cstddef>
#include "base/rand_util.h"
@@ -64,41 +64,4 @@ AckHandle::AckHandle(const std::string& state, base::Time timestamp)
AckHandle::~AckHandle() {
}
-const int64 Invalidation::kUnknownVersion = -1;
-
-Invalidation::Invalidation()
- : version(kUnknownVersion), ack_handle(AckHandle::InvalidAckHandle()) {
-}
-
-Invalidation::~Invalidation() {
-}
-
-bool Invalidation::Equals(const Invalidation& other) const {
- return (version == other.version) && (payload == other.payload) &&
- ack_handle.Equals(other.ack_handle);
-}
-
-scoped_ptr<base::DictionaryValue> Invalidation::ToValue() const {
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- value->SetString("version", base::Int64ToString(version));
- value->SetString("payload", payload);
- value->Set("ackHandle", ack_handle.ToValue().release());
- return value.Pass();
-}
-
-bool Invalidation::ResetFromValue(const base::DictionaryValue& value) {
- const base::DictionaryValue* ack_handle_value = NULL;
- std::string version_as_string;
- if (value.GetString("version", &version_as_string)) {
- if (!base::StringToInt64(version_as_string, &version))
- return false;
- } else {
- version = kUnknownVersion;
- }
- return
- value.GetString("payload", &payload) &&
- value.GetDictionary("ackHandle", &ack_handle_value) &&
- ack_handle.ResetFromValue(*ack_handle_value);
-}
-
} // namespace syncer
« no previous file with comments | « sync/internal_api/public/base/ack_handle.h ('k') | sync/internal_api/public/base/invalidation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698