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 "sync/internal_api/public/sessions/sync_session_snapshot.h" | 5 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "sync/protocol/proto_enum_conversions.h" | 13 #include "sync/protocol/proto_enum_conversions.h" |
13 | 14 |
14 namespace syncer { | 15 namespace syncer { |
15 namespace sessions { | 16 namespace sessions { |
16 | 17 |
17 SyncSessionSnapshot::SyncSessionSnapshot() | 18 SyncSessionSnapshot::SyncSessionSnapshot() |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 new base::DictionaryValue()); | 94 new base::DictionaryValue()); |
94 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { | 95 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) { |
95 scoped_ptr<base::DictionaryValue> type_entries(new base::DictionaryValue()); | 96 scoped_ptr<base::DictionaryValue> type_entries(new base::DictionaryValue()); |
96 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); | 97 type_entries->SetInteger("numEntries", num_entries_by_type_[i]); |
97 type_entries->SetInteger("numToDeleteEntries", | 98 type_entries->SetInteger("numToDeleteEntries", |
98 num_to_delete_entries_by_type_[i]); | 99 num_to_delete_entries_by_type_[i]); |
99 | 100 |
100 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); | 101 const std::string model_type = ModelTypeToString(static_cast<ModelType>(i)); |
101 counter_entries->Set(model_type, type_entries.release()); | 102 counter_entries->Set(model_type, type_entries.release()); |
102 } | 103 } |
103 value->Set("counter_entries", counter_entries.Pass()); | 104 value->Set("counter_entries", std::move(counter_entries)); |
104 return value; | 105 return value; |
105 } | 106 } |
106 | 107 |
107 std::string SyncSessionSnapshot::ToString() const { | 108 std::string SyncSessionSnapshot::ToString() const { |
108 std::string json; | 109 std::string json; |
109 base::JSONWriter::WriteWithOptions( | 110 base::JSONWriter::WriteWithOptions( |
110 *ToValue(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); | 111 *ToValue(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); |
111 return json; | 112 return json; |
112 } | 113 } |
113 | 114 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return num_to_delete_entries_by_type_; | 162 return num_to_delete_entries_by_type_; |
162 } | 163 } |
163 | 164 |
164 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource | 165 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource |
165 SyncSessionSnapshot::legacy_updates_source() const { | 166 SyncSessionSnapshot::legacy_updates_source() const { |
166 return legacy_updates_source_; | 167 return legacy_updates_source_; |
167 } | 168 } |
168 | 169 |
169 } // namespace sessions | 170 } // namespace sessions |
170 } // namespace syncer | 171 } // namespace syncer |
OLD | NEW |