Chromium Code Reviews| Index: sync/syncable/syncable_id.h |
| diff --git a/sync/syncable/syncable_id.h b/sync/syncable/syncable_id.h |
| index bbfeb9325d7e09893e71a29380729376c2e6ddda..a4995b1cff5e3a31b49c6070bc0eaeaa0c5473fe 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() : s_("") {} |
|
pavely
2014/12/22 21:38:09
Did you write s_("") to make it more explicit and
stanisc
2014/12/22 21:56:01
You are right. s_ would auto-initialize to an empt
stanisc
2014/12/22 22:44:20
Done.
|
| 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_.size() == 0; } |
|
pavely
2014/12/22 21:38:09
nit:
replace "s_.size() == 0" with "s_.empty()"
O
stanisc
2014/12/22 22:44:20
Done.
|
| + inline void Clear() { s_ = ""; } |
| 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 |