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

Unified Diff: chrome/browser/supervised_user/supervised_user_settings_service.cc

Issue 1530763004: Add Statistics for SupervisedUserSettingService during merging and syncing data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added before and after association statistic. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/supervised_user_settings_service.cc
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc
index db09106b4e5df4dd6792f75746f69d280395fa07..902d014ae7c22268e6224082acb57b3536313750 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -215,6 +215,9 @@ SyncMergeResult SupervisedUserSettingsService::MergeDataAndStartSyncing(
// depending on whether they already exist) and move them to split settings.
SyncChangeList change_list;
base::DictionaryValue* queued_items = GetQueuedItems();
+ int num_added = 0;
+ int num_modified = 0;
+ int num_before_association = queued_items->size();
Bernhard Bauer 2016/01/05 09:37:30 This also doesn't seem quite right... This is only
Deepak 2016/01/05 13:29:19 I would like to do the changes of this file in sep
Bernhard Bauer 2016/01/05 14:10:54 Acknowledged.
for (base::DictionaryValue::Iterator it(*queued_items); !it.IsAtEnd();
it.Advance()) {
std::string key_suffix = it.key();
@@ -223,6 +226,10 @@ SyncMergeResult SupervisedUserSettingsService::MergeDataAndStartSyncing(
SyncChange::SyncChangeType change_type =
dict->HasKey(key_suffix) ? SyncChange::ACTION_UPDATE
: SyncChange::ACTION_ADD;
+ if (change_type == SyncChange::ACTION_ADD)
+ num_added++;
+ else
+ num_modified++;
change_list.push_back(SyncChange(FROM_HERE, change_type, data));
dict->SetWithoutPathExpansion(key_suffix, it.value().DeepCopy());
}
@@ -237,7 +244,10 @@ SyncMergeResult SupervisedUserSettingsService::MergeDataAndStartSyncing(
sync_processor_->ProcessSyncChanges(FROM_HERE, change_list));
}
- // TODO(bauerb): Statistics?
+ result.set_num_items_added(num_added);
+ result.set_num_items_modified(num_modified);
+ result.set_num_items_before_association(num_before_association);
+ result.set_num_items_after_association(num_added + num_modified);
return result;
}

Powered by Google App Engine
This is Rietveld 408576698