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

Side by Side Diff: components/sync/driver/about_sync_util.cc

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 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 "components/sync/driver/about_sync_util.h" 5 #include "components/sync/driver/about_sync_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
13 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
14 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
15 #include "base/values.h" 14 #include "base/values.h"
16 #include "components/signin/core/browser/signin_manager_base.h" 15 #include "components/signin/core/browser/signin_manager_base.h"
17 #include "components/sync/driver/sync_service.h" 16 #include "components/sync/driver/sync_service.h"
18 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" 17 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
19 #include "components/sync/engine/sync_status.h" 18 #include "components/sync/engine/sync_status.h"
20 #include "components/sync/engine/sync_string_conversions.h" 19 #include "components/sync/engine/sync_string_conversions.h"
21 #include "components/sync/model/time.h" 20 #include "components/sync/model/time.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Creates a 'section' for display on about:sync, consisting of a title and a 69 // Creates a 'section' for display on about:sync, consisting of a title and a
71 // list of fields. Returns a pointer to the new section. Note that 70 // list of fields. Returns a pointer to the new section. Note that
72 // |parent_list|, not the caller, owns the newly added section. 71 // |parent_list|, not the caller, owns the newly added section.
73 base::ListValue* AddSection(base::ListValue* parent_list, 72 base::ListValue* AddSection(base::ListValue* parent_list,
74 const std::string& title) { 73 const std::string& title) {
75 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); 74 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue());
76 base::ListValue* section_contents = new base::ListValue(); 75 base::ListValue* section_contents = new base::ListValue();
77 section->SetString("title", title); 76 section->SetString("title", title);
78 section->Set("data", section_contents); 77 section->Set("data", section_contents);
79 section->SetBoolean("is_sensitive", false); 78 section->SetBoolean("is_sensitive", false);
80 // If the following |Append| results in a reallocation, pointers to the
81 // members of |parent_list| will be invalidated. This would result in
82 // use-after-free in |*SyncStat::SetValue|. This is why the following CHECK is
83 // necessary to ensure no reallocation takes place.
84 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
85 CHECK_LT(parent_list->GetSize(), parent_list->capacity());
86 parent_list->Append(std::move(section)); 79 parent_list->Append(std::move(section));
87 return section_contents; 80 return section_contents;
88 } 81 }
89 82
90 // Same as AddSection, but for data that should be elided when dumped into text 83 // Same as AddSection, but for data that should be elided when dumped into text
91 // form and posted in a public forum (e.g. unique identifiers). 84 // form and posted in a public forum (e.g. unique identifiers).
92 base::ListValue* AddSensitiveSection(base::ListValue* parent_list, 85 base::ListValue* AddSensitiveSection(base::ListValue* parent_list,
93 const std::string& title) { 86 const std::string& title) {
94 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); 87 std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue());
95 base::ListValue* section_contents = new base::ListValue(); 88 base::ListValue* section_contents = new base::ListValue();
96 section->SetString("title", title); 89 section->SetString("title", title);
97 section->Set("data", section_contents); 90 section->Set("data", section_contents);
98 section->SetBoolean("is_sensitive", true); 91 section->SetBoolean("is_sensitive", true);
99 // If the following |Append| results in a reallocation, pointers to
100 // |parent_list| and its members will be invalidated. This would result in
101 // use-after-free in |*SyncStat::SetValue|. This is why the following CHECK is
102 // necessary to ensure no reallocation takes place.
103 CHECK_LT(parent_list->GetSize(), parent_list->capacity());
104 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
105 parent_list->Append(std::move(section)); 92 parent_list->Append(std::move(section));
106 return section_contents; 93 return section_contents;
107 } 94 }
108 95
109 // The following helper classes help manage the about:sync fields which will be 96 // The following helper classes help manage the about:sync fields which will be
110 // populated in method in ConstructAboutInformation. 97 // populated in method in ConstructAboutInformation.
111 // 98 //
112 // Each instance of one of thse classes indicates a field in about:sync. Each 99 // Each instance of one of thse classes indicates a field in about:sync. Each
113 // field will be serialized to a DictionaryValue with entries for 'stat_name', 100 // field will be serialized to a DictionaryValue with entries for 'stat_name',
114 // 'stat_value' and 'is_valid'. 101 // 'stat_value' and 'is_valid'.
115 102
116 class StringSyncStat { 103 class StringSyncStat {
117 public: 104 public:
118 StringSyncStat(base::ListValue* section, const std::string& key); 105 StringSyncStat(base::ListValue* section, const std::string& key);
119 void SetValue(const std::string& value); 106 void SetValue(const std::string& value);
120 void SetValue(const base::string16& value); 107 void SetValue(const base::string16& value);
121 108
122 private: 109 private:
123 // Owned by the |section| passed in during construction. 110 // Owned by the |section| passed in during construction.
124 base::DictionaryValue* stat_; 111 base::DictionaryValue* stat_;
125 }; 112 };
126 113
127 StringSyncStat::StringSyncStat(base::ListValue* section, 114 StringSyncStat::StringSyncStat(base::ListValue* section,
128 const std::string& key) { 115 const std::string& key) {
129 stat_ = new base::DictionaryValue(); 116 stat_ = new base::DictionaryValue();
130 stat_->SetString("stat_name", key); 117 stat_->SetString("stat_name", key);
131 stat_->SetString("stat_value", "Uninitialized"); 118 stat_->SetString("stat_value", "Uninitialized");
132 stat_->SetBoolean("is_valid", false); 119 stat_->SetBoolean("is_valid", false);
133 // |stat_| will be invalidated by |Append|, so it needs to be reset.
134 // Furthermore, if |Append| results in a reallocation, |stat_| members of
135 // other SyncStats will be invalidated. This is why the following check is
136 // necessary, so that it is guaranteed that a reallocation will not happen.
137 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
138 CHECK_LT(section->GetSize(), section->capacity());
139 section->Append(base::WrapUnique(stat_)); 120 section->Append(base::WrapUnique(stat_));
140 section->GetDictionary(section->GetSize() - 1, &stat_);
141 } 121 }
142 122
143 void StringSyncStat::SetValue(const std::string& value) { 123 void StringSyncStat::SetValue(const std::string& value) {
144 stat_->SetString("stat_value", value); 124 stat_->SetString("stat_value", value);
145 stat_->SetBoolean("is_valid", true); 125 stat_->SetBoolean("is_valid", true);
146 } 126 }
147 127
148 void StringSyncStat::SetValue(const base::string16& value) { 128 void StringSyncStat::SetValue(const base::string16& value) {
149 stat_->SetString("stat_value", value); 129 stat_->SetString("stat_value", value);
150 stat_->SetBoolean("is_valid", true); 130 stat_->SetBoolean("is_valid", true);
151 } 131 }
152 132
153 class BoolSyncStat { 133 class BoolSyncStat {
154 public: 134 public:
155 BoolSyncStat(base::ListValue* section, const std::string& key); 135 BoolSyncStat(base::ListValue* section, const std::string& key);
156 void SetValue(bool value); 136 void SetValue(bool value);
157 137
158 private: 138 private:
159 // Owned by the |section| passed in during construction. 139 // Owned by the |section| passed in during construction.
160 base::DictionaryValue* stat_; 140 base::DictionaryValue* stat_;
161 }; 141 };
162 142
163 BoolSyncStat::BoolSyncStat(base::ListValue* section, const std::string& key) { 143 BoolSyncStat::BoolSyncStat(base::ListValue* section, const std::string& key) {
164 stat_ = new base::DictionaryValue(); 144 stat_ = new base::DictionaryValue();
165 stat_->SetString("stat_name", key); 145 stat_->SetString("stat_name", key);
166 stat_->SetBoolean("stat_value", false); 146 stat_->SetBoolean("stat_value", false);
167 stat_->SetBoolean("is_valid", false); 147 stat_->SetBoolean("is_valid", false);
168 // |stat_| will be invalidated by |Append|, so it needs to be reset.
169 // Furthermore, if |Append| results in a reallocation, |stat_| members of
170 // other SyncStats will be invalidated. This is why the following check is
171 // necessary, so that it is guaranteed that a reallocation will not happen.
172 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
173 CHECK_LT(section->GetSize(), section->capacity());
174 section->Append(base::WrapUnique(stat_)); 148 section->Append(base::WrapUnique(stat_));
175 section->GetDictionary(section->GetSize() - 1, &stat_);
176 } 149 }
177 150
178 void BoolSyncStat::SetValue(bool value) { 151 void BoolSyncStat::SetValue(bool value) {
179 stat_->SetBoolean("stat_value", value); 152 stat_->SetBoolean("stat_value", value);
180 stat_->SetBoolean("is_valid", true); 153 stat_->SetBoolean("is_valid", true);
181 } 154 }
182 155
183 class IntSyncStat { 156 class IntSyncStat {
184 public: 157 public:
185 IntSyncStat(base::ListValue* section, const std::string& key); 158 IntSyncStat(base::ListValue* section, const std::string& key);
186 void SetValue(int value); 159 void SetValue(int value);
187 160
188 private: 161 private:
189 // Owned by the |section| passed in during construction. 162 // Owned by the |section| passed in during construction.
190 base::DictionaryValue* stat_; 163 base::DictionaryValue* stat_;
191 }; 164 };
192 165
193 IntSyncStat::IntSyncStat(base::ListValue* section, const std::string& key) { 166 IntSyncStat::IntSyncStat(base::ListValue* section, const std::string& key) {
194 stat_ = new base::DictionaryValue(); 167 stat_ = new base::DictionaryValue();
195 stat_->SetString("stat_name", key); 168 stat_->SetString("stat_name", key);
196 stat_->SetInteger("stat_value", 0); 169 stat_->SetInteger("stat_value", 0);
197 stat_->SetBoolean("is_valid", false); 170 stat_->SetBoolean("is_valid", false);
198 // |stat_| will be invalidated by |Append|, so it needs to be reset.
199 // Furthermore, if |Append| results in a reallocation, |stat_| members of
200 // other SyncStats will be invalidated. This is why the following check is
201 // necessary, so that it is guaranteed that a reallocation will not happen.
202 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
203 CHECK_LT(section->GetSize(), section->capacity());
204 section->Append(base::WrapUnique(stat_)); 171 section->Append(base::WrapUnique(stat_));
205 section->GetDictionary(section->GetSize() - 1, &stat_);
206 } 172 }
207 173
208 void IntSyncStat::SetValue(int value) { 174 void IntSyncStat::SetValue(int value) {
209 stat_->SetInteger("stat_value", value); 175 stat_->SetInteger("stat_value", value);
210 stat_->SetBoolean("is_valid", true); 176 stat_->SetBoolean("is_valid", true);
211 } 177 }
212 178
213 // Returns a string describing the chrome version environment. Version format: 179 // Returns a string describing the chrome version environment. Version format:
214 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel"> 180 // <Build Info> <OS> <Version number> (<Last change>)<channel or "-devel">
215 // If version information is unavailable, returns "invalid." 181 // If version information is unavailable, returns "invalid."
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // classes defined above. 244 // classes defined above.
279 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation( 245 std::unique_ptr<base::DictionaryValue> ConstructAboutInformation(
280 SyncService* service, 246 SyncService* service,
281 SigninManagerBase* signin, 247 SigninManagerBase* signin,
282 version_info::Channel channel) { 248 version_info::Channel channel) {
283 std::unique_ptr<base::DictionaryValue> about_info( 249 std::unique_ptr<base::DictionaryValue> about_info(
284 new base::DictionaryValue()); 250 new base::DictionaryValue());
285 251
286 // 'details': A list of sections. 252 // 'details': A list of sections.
287 base::ListValue* stats_list = new base::ListValue(); 253 base::ListValue* stats_list = new base::ListValue();
288 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
289 stats_list->Reserve(12);
290 254
291 // The following lines define the sections and their fields. For each field, 255 // The following lines define the sections and their fields. For each field,
292 // a class is instantiated, which allows us to reference the fields in 256 // a class is instantiated, which allows us to reference the fields in
293 // 'setter' code later on in this function. 257 // 'setter' code later on in this function.
294 base::ListValue* section_summary = AddSection(stats_list, "Summary"); 258 base::ListValue* section_summary = AddSection(stats_list, "Summary");
295 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
296 section_summary->Reserve(1);
297 StringSyncStat summary_string(section_summary, "Summary"); 259 StringSyncStat summary_string(section_summary, "Summary");
298 260
299 base::ListValue* section_version = AddSection(stats_list, "Version Info"); 261 base::ListValue* section_version = AddSection(stats_list, "Version Info");
300 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
301 section_version->Reserve(2);
302 StringSyncStat client_version(section_version, "Client Version"); 262 StringSyncStat client_version(section_version, "Client Version");
303 StringSyncStat server_url(section_version, "Server URL"); 263 StringSyncStat server_url(section_version, "Server URL");
304 264
305 base::ListValue* section_identity = 265 base::ListValue* section_identity =
306 AddSensitiveSection(stats_list, kIdentityTitle); 266 AddSensitiveSection(stats_list, kIdentityTitle);
307 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
308 section_identity->Reserve(3);
309 StringSyncStat sync_id(section_identity, "Sync Client ID"); 267 StringSyncStat sync_id(section_identity, "Sync Client ID");
310 StringSyncStat invalidator_id(section_identity, "Invalidator Client ID"); 268 StringSyncStat invalidator_id(section_identity, "Invalidator Client ID");
311 StringSyncStat username(section_identity, "Username"); 269 StringSyncStat username(section_identity, "Username");
312 270
313 base::ListValue* section_credentials = AddSection(stats_list, "Credentials"); 271 base::ListValue* section_credentials = AddSection(stats_list, "Credentials");
314 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
315 section_credentials->Reserve(4);
316 StringSyncStat request_token_time(section_credentials, "Requested Token"); 272 StringSyncStat request_token_time(section_credentials, "Requested Token");
317 StringSyncStat receive_token_time(section_credentials, "Received Token"); 273 StringSyncStat receive_token_time(section_credentials, "Received Token");
318 StringSyncStat token_request_status(section_credentials, 274 StringSyncStat token_request_status(section_credentials,
319 "Token Request Status"); 275 "Token Request Status");
320 StringSyncStat next_token_request(section_credentials, "Next Token Request"); 276 StringSyncStat next_token_request(section_credentials, "Next Token Request");
321 277
322 base::ListValue* section_local = AddSection(stats_list, "Local State"); 278 base::ListValue* section_local = AddSection(stats_list, "Local State");
323 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
324 section_local->Reserve(7);
325 StringSyncStat server_connection(section_local, "Server Connection"); 279 StringSyncStat server_connection(section_local, "Server Connection");
326 StringSyncStat last_synced(section_local, "Last Synced"); 280 StringSyncStat last_synced(section_local, "Last Synced");
327 BoolSyncStat is_setup_complete(section_local, 281 BoolSyncStat is_setup_complete(section_local,
328 "Sync First-Time Setup Complete"); 282 "Sync First-Time Setup Complete");
329 StringSyncStat backend_initialization(section_local, 283 StringSyncStat backend_initialization(section_local,
330 "Sync Backend Initialization"); 284 "Sync Backend Initialization");
331 BoolSyncStat is_syncing(section_local, "Syncing"); 285 BoolSyncStat is_syncing(section_local, "Syncing");
332 BoolSyncStat is_local_sync_enabled(section_local, 286 BoolSyncStat is_local_sync_enabled(section_local,
333 "Local sync backend enabled"); 287 "Local sync backend enabled");
334 StringSyncStat local_backend_path(section_local, "Local backend path"); 288 StringSyncStat local_backend_path(section_local, "Local backend path");
335 289
336 base::ListValue* section_network = AddSection(stats_list, "Network"); 290 base::ListValue* section_network = AddSection(stats_list, "Network");
337 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
338 section_network->Reserve(3);
339 BoolSyncStat is_throttled(section_network, "Throttled"); 291 BoolSyncStat is_throttled(section_network, "Throttled");
340 StringSyncStat retry_time(section_network, "Retry time (maybe stale)"); 292 StringSyncStat retry_time(section_network, "Retry time (maybe stale)");
341 BoolSyncStat are_notifications_enabled(section_network, 293 BoolSyncStat are_notifications_enabled(section_network,
342 "Notifications Enabled"); 294 "Notifications Enabled");
343 295
344 base::ListValue* section_encryption = AddSection(stats_list, "Encryption"); 296 base::ListValue* section_encryption = AddSection(stats_list, "Encryption");
345 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
346 section_encryption->Reserve(9);
347 BoolSyncStat is_using_explicit_passphrase(section_encryption, 297 BoolSyncStat is_using_explicit_passphrase(section_encryption,
348 "Explicit Passphrase"); 298 "Explicit Passphrase");
349 BoolSyncStat is_passphrase_required(section_encryption, 299 BoolSyncStat is_passphrase_required(section_encryption,
350 "Passphrase Required"); 300 "Passphrase Required");
351 BoolSyncStat is_cryptographer_ready(section_encryption, 301 BoolSyncStat is_cryptographer_ready(section_encryption,
352 "Cryptographer Ready"); 302 "Cryptographer Ready");
353 BoolSyncStat has_pending_keys(section_encryption, 303 BoolSyncStat has_pending_keys(section_encryption,
354 "Cryptographer Has Pending Keys"); 304 "Cryptographer Has Pending Keys");
355 StringSyncStat encrypted_types(section_encryption, "Encrypted Types"); 305 StringSyncStat encrypted_types(section_encryption, "Encrypted Types");
356 BoolSyncStat has_keystore_key(section_encryption, "Has Keystore Key"); 306 BoolSyncStat has_keystore_key(section_encryption, "Has Keystore Key");
357 StringSyncStat keystore_migration_time(section_encryption, 307 StringSyncStat keystore_migration_time(section_encryption,
358 "Keystore Migration Time"); 308 "Keystore Migration Time");
359 StringSyncStat passphrase_type(section_encryption, "Passphrase Type"); 309 StringSyncStat passphrase_type(section_encryption, "Passphrase Type");
360 StringSyncStat passphrase_time(section_encryption, "Passphrase Time"); 310 StringSyncStat passphrase_time(section_encryption, "Passphrase Time");
361 311
362 base::ListValue* section_last_session = 312 base::ListValue* section_last_session =
363 AddSection(stats_list, "Status from Last Completed Session"); 313 AddSection(stats_list, "Status from Last Completed Session");
364 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
365 section_last_session->Reserve(4);
366 StringSyncStat session_source(section_last_session, "Sync Source"); 314 StringSyncStat session_source(section_last_session, "Sync Source");
367 StringSyncStat get_key_result(section_last_session, "GetKey Step Result"); 315 StringSyncStat get_key_result(section_last_session, "GetKey Step Result");
368 StringSyncStat download_result(section_last_session, "Download Step Result"); 316 StringSyncStat download_result(section_last_session, "Download Step Result");
369 StringSyncStat commit_result(section_last_session, "Commit Step Result"); 317 StringSyncStat commit_result(section_last_session, "Commit Step Result");
370 318
371 base::ListValue* section_counters = AddSection(stats_list, "Running Totals"); 319 base::ListValue* section_counters = AddSection(stats_list, "Running Totals");
372 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
373 section_counters->Reserve(7);
374 IntSyncStat notifications_received(section_counters, 320 IntSyncStat notifications_received(section_counters,
375 "Notifications Received"); 321 "Notifications Received");
376 IntSyncStat updates_received(section_counters, "Updates Downloaded"); 322 IntSyncStat updates_received(section_counters, "Updates Downloaded");
377 IntSyncStat tombstone_updates(section_counters, "Tombstone Updates"); 323 IntSyncStat tombstone_updates(section_counters, "Tombstone Updates");
378 IntSyncStat reflected_updates(section_counters, "Reflected Updates"); 324 IntSyncStat reflected_updates(section_counters, "Reflected Updates");
379 IntSyncStat successful_commits(section_counters, "Successful Commits"); 325 IntSyncStat successful_commits(section_counters, "Successful Commits");
380 IntSyncStat conflicts_resolved_local_wins(section_counters, 326 IntSyncStat conflicts_resolved_local_wins(section_counters,
381 "Conflicts Resolved: Client Wins"); 327 "Conflicts Resolved: Client Wins");
382 IntSyncStat conflicts_resolved_server_wins(section_counters, 328 IntSyncStat conflicts_resolved_server_wins(section_counters,
383 "Conflicts Resolved: Server Wins"); 329 "Conflicts Resolved: Server Wins");
384 330
385 base::ListValue* section_this_cycle = 331 base::ListValue* section_this_cycle =
386 AddSection(stats_list, "Transient Counters (this cycle)"); 332 AddSection(stats_list, "Transient Counters (this cycle)");
387 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
388 section_this_cycle->Reserve(4);
389 IntSyncStat encryption_conflicts(section_this_cycle, "Encryption Conflicts"); 333 IntSyncStat encryption_conflicts(section_this_cycle, "Encryption Conflicts");
390 IntSyncStat hierarchy_conflicts(section_this_cycle, "Hierarchy Conflicts"); 334 IntSyncStat hierarchy_conflicts(section_this_cycle, "Hierarchy Conflicts");
391 IntSyncStat server_conflicts(section_this_cycle, "Server Conflicts"); 335 IntSyncStat server_conflicts(section_this_cycle, "Server Conflicts");
392 IntSyncStat committed_items(section_this_cycle, "Committed Items"); 336 IntSyncStat committed_items(section_this_cycle, "Committed Items");
393 337
394 base::ListValue* section_that_cycle = AddSection( 338 base::ListValue* section_that_cycle = AddSection(
395 stats_list, "Transient Counters (last cycle of last completed session)"); 339 stats_list, "Transient Counters (last cycle of last completed session)");
396 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
397 section_that_cycle->Reserve(3);
398 IntSyncStat updates_downloaded(section_that_cycle, "Updates Downloaded"); 340 IntSyncStat updates_downloaded(section_that_cycle, "Updates Downloaded");
399 IntSyncStat committed_count(section_that_cycle, "Committed Count"); 341 IntSyncStat committed_count(section_that_cycle, "Committed Count");
400 IntSyncStat entries(section_that_cycle, "Entries"); 342 IntSyncStat entries(section_that_cycle, "Entries");
401 343
402 base::ListValue* section_nudge_info = 344 base::ListValue* section_nudge_info =
403 AddSection(stats_list, "Nudge Source Counters"); 345 AddSection(stats_list, "Nudge Source Counters");
404 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
405 section_nudge_info->Reserve(3);
406 IntSyncStat nudge_source_notification(section_nudge_info, 346 IntSyncStat nudge_source_notification(section_nudge_info,
407 "Server Invalidations"); 347 "Server Invalidations");
408 IntSyncStat nudge_source_local(section_nudge_info, "Local Changes"); 348 IntSyncStat nudge_source_local(section_nudge_info, "Local Changes");
409 IntSyncStat nudge_source_local_refresh(section_nudge_info, "Local Refreshes"); 349 IntSyncStat nudge_source_local_refresh(section_nudge_info, "Local Refreshes");
410 350
411 // This list of sections belongs in the 'details' field of the returned 351 // This list of sections belongs in the 'details' field of the returned
412 // message. 352 // message.
413 about_info->Set(kDetailsKey, stats_list); 353 about_info->Set(kDetailsKey, stats_list);
414 354
415 // Populate all the fields we declared above. 355 // Populate all the fields we declared above.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 full_status.sync_protocol_error.error_type != UNKNOWN_ERROR && 484 full_status.sync_protocol_error.error_type != UNKNOWN_ERROR &&
545 full_status.sync_protocol_error.error_type != SYNC_SUCCESS; 485 full_status.sync_protocol_error.error_type != SYNC_SUCCESS;
546 486
547 about_info->SetBoolean("actionable_error_detected", 487 about_info->SetBoolean("actionable_error_detected",
548 actionable_error_detected); 488 actionable_error_detected);
549 489
550 // NOTE: We won't bother showing any of the following values unless 490 // NOTE: We won't bother showing any of the following values unless
551 // actionable_error_detected is set. 491 // actionable_error_detected is set.
552 492
553 base::ListValue* actionable_error = new base::ListValue(); 493 base::ListValue* actionable_error = new base::ListValue();
554 // TODO(crbug.com/702230): Remove the usages of raw pointers in this file.
555 actionable_error->Reserve(4);
556 about_info->Set("actionable_error", actionable_error); 494 about_info->Set("actionable_error", actionable_error);
557 495
558 StringSyncStat error_type(actionable_error, "Error Type"); 496 StringSyncStat error_type(actionable_error, "Error Type");
559 StringSyncStat action(actionable_error, "Action"); 497 StringSyncStat action(actionable_error, "Action");
560 StringSyncStat url(actionable_error, "URL"); 498 StringSyncStat url(actionable_error, "URL");
561 StringSyncStat description(actionable_error, "Error Description"); 499 StringSyncStat description(actionable_error, "Error Description");
562 500
563 if (actionable_error_detected) { 501 if (actionable_error_detected) {
564 error_type.SetValue( 502 error_type.SetValue(
565 GetSyncErrorTypeString(full_status.sync_protocol_error.error_type)); 503 GetSyncErrorTypeString(full_status.sync_protocol_error.error_type));
(...skipping 18 matching lines...) Expand all
584 } 522 }
585 523
586 about_info->Set("type_status", service->GetTypeStatusMap()); 524 about_info->Set("type_status", service->GetTypeStatusMap());
587 525
588 return about_info; 526 return about_info;
589 } 527 }
590 528
591 } // namespace sync_ui_util 529 } // namespace sync_ui_util
592 530
593 } // namespace syncer 531 } // namespace syncer
OLDNEW
« no previous file with comments | « components/ssl_config/ssl_config_service_manager_pref.cc ('k') | components/sync/syncable/model_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698