OLD | NEW |
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_ORDINAL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_ORDINAL_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_ORDINAL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_ORDINAL_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <string> | 10 #include <string> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return true; | 253 return true; |
254 | 254 |
255 if (!IsValid() || !other.IsValid()) | 255 if (!IsValid() || !other.IsValid()) |
256 return false; | 256 return false; |
257 | 257 |
258 return Equals(other); | 258 return Equals(other); |
259 } | 259 } |
260 | 260 |
261 template <typename Traits> | 261 template <typename Traits> |
262 std::string Ordinal<Traits>::ToDebugString() const { | 262 std::string Ordinal<Traits>::ToDebugString() const { |
263 std::string debug_string; | 263 std::string debug_string = |
264 base::JsonDoubleQuote(bytes_, false /* put_in_quotes */, &debug_string); | 264 base::EscapeBytesAsInvalidJSONString(bytes_, false /* put_in_quotes */); |
265 if (!is_valid_) { | 265 if (!is_valid_) { |
266 debug_string = "INVALID[" + debug_string + "]"; | 266 debug_string = "INVALID[" + debug_string + "]"; |
267 } | 267 } |
268 return debug_string; | 268 return debug_string; |
269 } | 269 } |
270 | 270 |
271 template <typename Traits> | 271 template <typename Traits> |
272 bool Ordinal<Traits>::LessThan(const Ordinal& other) const { | 272 bool Ordinal<Traits>::LessThan(const Ordinal& other) const { |
273 CHECK(IsValid()); | 273 CHECK(IsValid()); |
274 CHECK(other.IsValid()); | 274 CHECK(other.IsValid()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 DCHECK_LT(midpoint, end_bytes); | 477 DCHECK_LT(midpoint, end_bytes); |
478 | 478 |
479 Ordinal<Traits> midpoint_ordinal(midpoint); | 479 Ordinal<Traits> midpoint_ordinal(midpoint); |
480 DCHECK(midpoint_ordinal.IsValid()); | 480 DCHECK(midpoint_ordinal.IsValid()); |
481 return midpoint_ordinal; | 481 return midpoint_ordinal; |
482 } | 482 } |
483 | 483 |
484 } // namespace syncer | 484 } // namespace syncer |
485 | 485 |
486 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_ORDINAL_H_ | 486 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_ORDINAL_H_ |
OLD | NEW |