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

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

Issue 1258863007: [Sync] Add more info for invalid position check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove change from directory since too much test failures Created 5 years, 4 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
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 #include "sync/syncable/entry_kernel.h" 5 #include "sync/syncable/entry_kernel.h"
6 6
7 #include "base/json/string_escape.h"
7 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
8 #include "sync/protocol/proto_value_conversions.h" 9 #include "sync/protocol/proto_value_conversions.h"
9 #include "sync/syncable/syncable_enum_conversions.h" 10 #include "sync/syncable/syncable_enum_conversions.h"
10 #include "sync/util/cryptographer.h" 11 #include "sync/util/cryptographer.h"
11 12
12 namespace syncer { 13 namespace syncer {
13 namespace syncable { 14 namespace syncable {
14 15
15 EntryKernel::EntryKernel() : dirty_(false) { 16 EntryKernel::EntryKernel() : dirty_(false) {
16 // Everything else should already be default-initialized. 17 // Everything else should already be default-initialized.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 230 }
230 231
231 base::DictionaryValue* EntryKernelMutationToValue( 232 base::DictionaryValue* EntryKernelMutationToValue(
232 const EntryKernelMutation& mutation) { 233 const EntryKernelMutation& mutation) {
233 base::DictionaryValue* dict = new base::DictionaryValue(); 234 base::DictionaryValue* dict = new base::DictionaryValue();
234 dict->Set("original", mutation.original.ToValue(NULL)); 235 dict->Set("original", mutation.original.ToValue(NULL));
235 dict->Set("mutated", mutation.mutated.ToValue(NULL)); 236 dict->Set("mutated", mutation.mutated.ToValue(NULL));
236 return dict; 237 return dict;
237 } 238 }
238 239
240 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel) {
241 int i;
242 EntryKernel* const kernel = const_cast<EntryKernel*>(&entry_kernel);
243 for (i = BEGIN_FIELDS; i < INT64_FIELDS_END; ++i) {
244 os << g_metas_columns[i].name << ": "
245 << kernel->ref(static_cast<Int64Field>(i)) << ", ";
246 }
247 for (; i < TIME_FIELDS_END; ++i) {
248 os << g_metas_columns[i].name << ": "
249 << GetTimeDebugString(kernel->ref(static_cast<TimeField>(i))) << ", ";
250 }
251 for (; i < ID_FIELDS_END; ++i) {
252 os << g_metas_columns[i].name << ": "
253 << kernel->ref(static_cast<IdField>(i)) << ", ";
254 }
255 os << "Flags: ";
256 for (; i < BIT_FIELDS_END; ++i) {
257 if (kernel->ref(static_cast<BitField>(i)))
258 os << g_metas_columns[i].name << ", ";
259 }
260 for (; i < STRING_FIELDS_END; ++i) {
261 const std::string& field = kernel->ref(static_cast<StringField>(i));
262 os << g_metas_columns[i].name << ": " << field << ", ";
263 }
264 for (; i < PROTO_FIELDS_END; ++i) {
265 std::string escaped_str = base::EscapeBytesAsInvalidJSONString(
266 kernel->ref(static_cast<ProtoField>(i)).SerializeAsString(), false);
267 os << g_metas_columns[i].name << ": " << escaped_str << ", ";
268 }
269 for (; i < UNIQUE_POSITION_FIELDS_END; ++i) {
270 os << g_metas_columns[i].name << ": "
271 << kernel->ref(static_cast<UniquePositionField>(i)).ToDebugString()
272 << ", ";
273 }
274 for (; i < ATTACHMENT_METADATA_FIELDS_END; ++i) {
275 std::string escaped_str = base::EscapeBytesAsInvalidJSONString(
276 kernel->ref(static_cast<AttachmentMetadataField>(i))
277 .SerializeAsString(),
278 false);
279 os << g_metas_columns[i].name << ": " << escaped_str << ", ";
280 }
281 os << "TempFlags: ";
282 for (; i < BIT_TEMPS_END; ++i) {
283 if (kernel->ref(static_cast<BitTemp>(i)))
284 os << "#" << i - BIT_TEMPS_BEGIN << ", ";
285 }
286 return os;
287 }
288
239 } // namespace syncer 289 } // namespace syncer
240 } // namespace syncable 290 } // namespace syncable
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698