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

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

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

Powered by Google App Engine
This is Rietveld 408576698