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

Unified Diff: sync/syncable/syncable_id.h

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_base_transaction.cc ('k') | sync/syncable/syncable_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/syncable_id.h
diff --git a/sync/syncable/syncable_id.h b/sync/syncable/syncable_id.h
index bbfeb9325d7e09893e71a29380729376c2e6ddda..5b40114b9216306299d76a2c3201d07813e13f06 100644
--- a/sync/syncable/syncable_id.h
+++ b/sync/syncable/syncable_id.h
@@ -43,9 +43,7 @@ SYNC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, const Id& id);
// 3. s<server provided opaque id> for items that the server knows about.
class SYNC_EXPORT Id {
public:
- // This constructor will be handy even when we move away from int64s, just
- // for unit tests.
- inline Id() : s_("r") { }
+ inline Id() {}
inline Id(const Id& that) {
Copy(that);
}
@@ -63,14 +61,8 @@ class SYNC_EXPORT Id {
return s_[0] == 's' || s_ == "r";
}
- // TODO(sync): We could use null here, but to ease conversion we use "r".
- // fix this, this is madness :)
- inline bool IsNull() const {
- return IsRoot();
- }
- inline void Clear() {
- s_ = "r";
- }
+ inline bool IsNull() const { return s_.empty(); }
+ inline void Clear() { s_.clear(); }
inline int compare(const Id& that) const {
return s_.compare(that.s_);
}
@@ -112,6 +104,9 @@ class SYNC_EXPORT Id {
// computing lower bounds on std::sets that are ordered by operator<.
static Id GetLeastIdForLexicographicComparison();
+ // Gets root ID.
+ static Id GetRoot();
+
private:
friend scoped_ptr<EntryKernel> UnpackEntry(sql::Statement* statement);
friend void BindFields(const EntryKernel& entry,
@@ -124,8 +119,6 @@ class SYNC_EXPORT Id {
std::string s_;
};
-SYNC_EXPORT_PRIVATE Id GetNullId();
-
} // namespace syncable
} // namespace syncer
« no previous file with comments | « sync/syncable/syncable_base_transaction.cc ('k') | sync/syncable/syncable_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698