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

Side by Side Diff: sync/syncable/entry.cc

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 | « sync/internal_api/public/base/progress_marker_map.cc ('k') | tools/gn/trace.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "sync/syncable/entry.h" 5 #include "sync/syncable/entry.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 os << "Flags: "; 140 os << "Flags: ";
141 for ( ; i < BIT_FIELDS_END; ++i) { 141 for ( ; i < BIT_FIELDS_END; ++i) {
142 if (kernel->ref(static_cast<BitField>(i))) 142 if (kernel->ref(static_cast<BitField>(i)))
143 os << g_metas_columns[i].name << ", "; 143 os << g_metas_columns[i].name << ", ";
144 } 144 }
145 for ( ; i < STRING_FIELDS_END; ++i) { 145 for ( ; i < STRING_FIELDS_END; ++i) {
146 const std::string& field = kernel->ref(static_cast<StringField>(i)); 146 const std::string& field = kernel->ref(static_cast<StringField>(i));
147 os << g_metas_columns[i].name << ": " << field << ", "; 147 os << g_metas_columns[i].name << ": " << field << ", ";
148 } 148 }
149 for ( ; i < PROTO_FIELDS_END; ++i) { 149 for ( ; i < PROTO_FIELDS_END; ++i) {
150 std::string escaped_str; 150 std::string escaped_str = base::EscapeBytesAsInvalidJSONString(
151 base::JsonDoubleQuote(
152 kernel->ref(static_cast<ProtoField>(i)).SerializeAsString(), 151 kernel->ref(static_cast<ProtoField>(i)).SerializeAsString(),
153 false, 152 false);
154 &escaped_str);
155 os << g_metas_columns[i].name << ": " << escaped_str << ", "; 153 os << g_metas_columns[i].name << ": " << escaped_str << ", ";
156 } 154 }
157 for ( ; i < UNIQUE_POSITION_FIELDS_END; ++i) { 155 for ( ; i < UNIQUE_POSITION_FIELDS_END; ++i) {
158 os << g_metas_columns[i].name << ": " 156 os << g_metas_columns[i].name << ": "
159 << kernel->ref(static_cast<UniquePositionField>(i)).ToDebugString() 157 << kernel->ref(static_cast<UniquePositionField>(i)).ToDebugString()
160 << ", "; 158 << ", ";
161 } 159 }
162 os << "TempFlags: "; 160 os << "TempFlags: ";
163 for ( ; i < BIT_TEMPS_END; ++i) { 161 for ( ; i < BIT_TEMPS_END; ++i) {
164 if (kernel->ref(static_cast<BitTemp>(i))) 162 if (kernel->ref(static_cast<BitTemp>(i)))
165 os << "#" << i - BIT_TEMPS_BEGIN << ", "; 163 os << "#" << i - BIT_TEMPS_BEGIN << ", ";
166 } 164 }
167 return os; 165 return os;
168 } 166 }
169 167
170 } // namespace syncable 168 } // namespace syncable
171 } // namespace syncer 169 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/base/progress_marker_map.cc ('k') | tools/gn/trace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698