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 #include "components/sync/syncable/entry_kernel.h" | 5 #include "components/sync/syncable/entry_kernel.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 &AttachmentMetadataToValue, ATTACHMENT_METADATA_FIELDS_BEGIN, | 206 &AttachmentMetadataToValue, ATTACHMENT_METADATA_FIELDS_BEGIN, |
207 ATTACHMENT_METADATA_FIELDS_END - 1); | 207 ATTACHMENT_METADATA_FIELDS_END - 1); |
208 | 208 |
209 // Bit temps. | 209 // Bit temps. |
210 SetFieldValues(*this, kernel_info, &GetBitTempString, &BooleanToValue, | 210 SetFieldValues(*this, kernel_info, &GetBitTempString, &BooleanToValue, |
211 BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); | 211 BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1); |
212 | 212 |
213 return kernel_info; | 213 return kernel_info; |
214 } | 214 } |
215 | 215 |
216 base::ListValue* EntryKernelMutationMapToValue( | 216 std::unique_ptr<base::ListValue> EntryKernelMutationMapToValue( |
217 const EntryKernelMutationMap& mutations) { | 217 const EntryKernelMutationMap& mutations) { |
218 base::ListValue* list = new base::ListValue(); | 218 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
219 for (EntryKernelMutationMap::const_iterator it = mutations.begin(); | 219 for (EntryKernelMutationMap::const_iterator it = mutations.begin(); |
220 it != mutations.end(); ++it) { | 220 it != mutations.end(); ++it) { |
221 list->Append(EntryKernelMutationToValue(it->second)); | 221 list->Append(EntryKernelMutationToValue(it->second)); |
222 } | 222 } |
223 return list; | 223 return list; |
224 } | 224 } |
225 | 225 |
226 base::DictionaryValue* EntryKernelMutationToValue( | 226 std::unique_ptr<base::DictionaryValue> EntryKernelMutationToValue( |
227 const EntryKernelMutation& mutation) { | 227 const EntryKernelMutation& mutation) { |
228 base::DictionaryValue* dict = new base::DictionaryValue(); | 228 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
229 dict->Set("original", mutation.original.ToValue(NULL)); | 229 dict->Set("original", mutation.original.ToValue(NULL)); |
230 dict->Set("mutated", mutation.mutated.ToValue(NULL)); | 230 dict->Set("mutated", mutation.mutated.ToValue(NULL)); |
231 return dict; | 231 return dict; |
232 } | 232 } |
233 | 233 |
234 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel) { | 234 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel) { |
235 int i; | 235 int i; |
236 EntryKernel* const kernel = const_cast<EntryKernel*>(&entry_kernel); | 236 EntryKernel* const kernel = const_cast<EntryKernel*>(&entry_kernel); |
237 for (i = BEGIN_FIELDS; i < INT64_FIELDS_END; ++i) { | 237 for (i = BEGIN_FIELDS; i < INT64_FIELDS_END; ++i) { |
238 os << g_metas_columns[i].name << ": " | 238 os << g_metas_columns[i].name << ": " |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 os << "TempFlags: "; | 275 os << "TempFlags: "; |
276 for (; i < BIT_TEMPS_END; ++i) { | 276 for (; i < BIT_TEMPS_END; ++i) { |
277 if (kernel->ref(static_cast<BitTemp>(i))) | 277 if (kernel->ref(static_cast<BitTemp>(i))) |
278 os << "#" << i - BIT_TEMPS_BEGIN << ", "; | 278 os << "#" << i - BIT_TEMPS_BEGIN << ", "; |
279 } | 279 } |
280 return os; | 280 return os; |
281 } | 281 } |
282 | 282 |
283 } // namespace syncable | 283 } // namespace syncable |
284 } // namespace syncer | 284 } // namespace syncer |
OLD | NEW |