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

Side by Side Diff: sync/internal_api/public/base/ordinal.h

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS page encodings Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | sync/internal_api/public/base/progress_marker_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
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_
OLDNEW
« no previous file with comments | « net/base/net_util_unittest.cc ('k') | sync/internal_api/public/base/progress_marker_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698