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

Unified Diff: sync/syncable/syncable_id.cc

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 6 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 | « sync/syncable/syncable_id.h ('k') | sync/test/engine/test_id_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/syncable_id.cc
diff --git a/sync/syncable/syncable_id.cc b/sync/syncable/syncable_id.cc
index 614fd3e128a70355dc812f488c5a097d84c48c7a..5cd777ff2eff81f67f70b519eda98417eecd5c60 100644
--- a/sync/syncable/syncable_id.cc
+++ b/sync/syncable/syncable_id.cc
@@ -6,6 +6,7 @@
#include <iosfwd>
+#include "base/logging.h"
#include "base/values.h"
using std::ostream;
@@ -26,6 +27,7 @@ base::StringValue* Id::ToValue() const {
string Id::GetServerId() const {
// Currently root is the string "0". We need to decide on a true value.
// "" would be convenient here, as the IsRoot call would not be needed.
+ DCHECK(!IsNull());
if (IsRoot())
return "0";
return s_.substr(1);
@@ -49,6 +51,12 @@ Id Id::CreateFromClientString(const string& local_id) {
return id;
}
+Id Id::GetRoot() {
+ Id id;
+ id.s_ = "r";
+ return id;
+}
+
Id Id::GetLexicographicSuccessor() const {
// The successor of a string is given by appending the least
// character in the alphabet.
@@ -64,9 +72,5 @@ Id Id::GetLeastIdForLexicographicComparison() {
return id;
}
-Id GetNullId() {
- return Id(); // Currently == root.
-}
-
} // namespace syncable
} // namespace syncer
« no previous file with comments | « sync/syncable/syncable_id.h ('k') | sync/test/engine/test_id_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698