| 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/engine/cycle/sync_cycle_snapshot.h" | 5 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 std::unique_ptr<base::DictionaryValue> counter_entries( | 88 std::unique_ptr<base::DictionaryValue> counter_entries( |
| 89 new base::DictionaryValue()); | 89 new base::DictionaryValue()); |
| 90 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { | 90 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { |
| 91 std::unique_ptr<base::DictionaryValue> type_entries( | 91 std::unique_ptr<base::DictionaryValue> type_entries( |
| 92 new base::DictionaryValue()); | 92 new base::DictionaryValue()); |
| 93 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); | 93 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); |
| 94 type_entries->SetInteger("numToDeleteEntries", | 94 type_entries->SetInteger("numToDeleteEntries", |
| 95 num_to_delete_entries_by_type_[i]); | 95 num_to_delete_entries_by_type_[i]); |
| 96 | 96 |
| 97 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); | 97 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); |
| 98 counter_entries->Set(model_type, type_entries.release()); | 98 counter_entries->Set(model_type, std::move(type_entries)); |
| 99 } | 99 } |
| 100 value->Set("counter_entries", std::move(counter_entries)); | 100 value->Set("counter_entries", std::move(counter_entries)); |
| 101 return value; | 101 return value; |
| 102 } | 102 } |
| 103 | 103 |
| 104 std::string SyncCycleSnapshot::ToString() const { | 104 std::string SyncCycleSnapshot::ToString() const { |
| 105 std::string json; | 105 std::string json; |
| 106 base::JSONWriter::WriteWithOptions( | 106 base::JSONWriter::WriteWithOptions( |
| 107 *ToValue(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); | 107 *ToValue(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); |
| 108 return json; | 108 return json; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const { | 156 const { |
| 157 return num_to_delete_entries_by_type_; | 157 return num_to_delete_entries_by_type_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource | 160 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource |
| 161 SyncCycleSnapshot::legacy_updates_source() const { | 161 SyncCycleSnapshot::legacy_updates_source() const { |
| 162 return legacy_updates_source_; | 162 return legacy_updates_source_; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace syncer | 165 } // namespace syncer |
| OLD | NEW |