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

Unified Diff: chrome/browser/sync/syncable/syncable_id.h

Issue 6588119: First-time sync: asymptotic running time improvement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/Release
Patch Set: Fix test bug. Created 9 years, 10 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 | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/syncable/syncable_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/syncable/syncable_id.h
diff --git a/chrome/browser/sync/syncable/syncable_id.h b/chrome/browser/sync/syncable/syncable_id.h
index d52a524199a260a5ef8a9d81f8aeaf95301f7715..abc7a02470da512b6adbbf4ac37690cc335c8cb3 100644
--- a/chrome/browser/sync/syncable/syncable_id.h
+++ b/chrome/browser/sync/syncable/syncable_id.h
@@ -79,7 +79,6 @@ class Id {
inline int compare(const Id& that) const {
return s_.compare(that.s_);
}
- // Must never allow id == 0 or id < 0 to compile.
inline bool operator == (const Id& that) const {
return s_ == that.s_;
}
@@ -92,6 +91,10 @@ class Id {
inline bool operator > (const Id& that) const {
return s_ > that.s_;
}
+ // Return the next highest ID in the lexicographic ordering. This is
+ // useful for computing upper bounds on std::sets that are ordered
+ // by operator<.
+ Id GetLexicographicSuccessor() const;
// Three functions are used to work with our proto buffers.
std::string GetServerId() const;
@@ -100,7 +103,12 @@ class Id {
// id from the server. Returns a client only opaque id.
static Id CreateFromClientString(const std::string& local_id);
- protected:
+ // This method returns an ID that will compare less than any valid ID.
+ // The returned ID is not a valid ID itself. This is useful for
+ // computing lower bounds on std::sets that are ordered by operator<.
+ static Id GetLeastIdForLexicographicComparison();
+
+ private:
std::string s_;
};
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/syncable/syncable_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698