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

Side by Side Diff: trunk/src/sync/internal_api/public/base/unique_position.h

Issue 270543005: Revert 270308 "sync: Improve handling of bad UniquePositions" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 28 matching lines...) Expand all
39 // This class currently has several bookmarks-related assumptions built in, 39 // This class currently has several bookmarks-related assumptions built in,
40 // though it could be adapted to be more generally useful. 40 // though it could be adapted to be more generally useful.
41 class SYNC_EXPORT_PRIVATE UniquePosition { 41 class SYNC_EXPORT_PRIVATE UniquePosition {
42 public: 42 public:
43 static const size_t kSuffixLength; 43 static const size_t kSuffixLength;
44 static const size_t kCompressBytesThreshold; 44 static const size_t kCompressBytesThreshold;
45 45
46 static bool IsValidSuffix(const std::string& suffix); 46 static bool IsValidSuffix(const std::string& suffix);
47 static bool IsValidBytes(const std::string& bytes); 47 static bool IsValidBytes(const std::string& bytes);
48 48
49 // Returns a valid, but mostly random suffix.
50 // Avoid using this; it can lead to inconsistent sort orderings if misused.
51 static std::string RandomSuffix();
52
53 // Returns an invalid position. 49 // Returns an invalid position.
54 static UniquePosition CreateInvalid(); 50 static UniquePosition CreateInvalid();
55 51
56 // Converts from a 'sync_pb::UniquePosition' protobuf to a UniquePosition. 52 // Converts from a 'sync_pb::UniquePosition' protobuf to a UniquePosition.
57 // This may return an invalid position if the parsing fails. 53 // This may return an invalid position if the parsing fails.
58 static UniquePosition FromProto(const sync_pb::UniquePosition& proto); 54 static UniquePosition FromProto(const sync_pb::UniquePosition& proto);
59 55
60 // Creates a position with the given suffix. Ordering among positions created 56 // Creates a position with the given suffix. Ordering among positions created
61 // from this function is the same as that of the integer parameters that were 57 // from this function is the same as that of the integer parameters that were
62 // passed in. 58 // passed in.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 131
136 // The position value after it has been run through the custom compression 132 // The position value after it has been run through the custom compression
137 // algorithm. See Compress() and Uncompress() functions above. 133 // algorithm. See Compress() and Uncompress() functions above.
138 std::string compressed_; 134 std::string compressed_;
139 bool is_valid_; 135 bool is_valid_;
140 }; 136 };
141 137
142 } // namespace syncer; 138 } // namespace syncer;
143 139
144 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ 140 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_
OLDNEW
« no previous file with comments | « trunk/src/sync/engine/syncer_util_unittest.cc ('k') | trunk/src/sync/internal_api/public/base/unique_position.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698