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

Unified Diff: sync/internal_api/debug_info_event_listener.cc

Issue 23866012: Send configuration stats together at the end of data type configuration so that (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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: sync/internal_api/debug_info_event_listener.cc
diff --git a/sync/internal_api/debug_info_event_listener.cc b/sync/internal_api/debug_info_event_listener.cc
index 64bbab87ed11d44982088d168a45243595959fe0..51e6c0f4d3b239c850908b452bf901bb42f91db6 100644
--- a/sync/internal_api/debug_info_event_listener.cc
+++ b/sync/internal_api/debug_info_event_listener.cc
@@ -177,76 +177,76 @@ base::WeakPtr<DataTypeDebugInfoListener> DebugInfoEventListener::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
-void DebugInfoEventListener::OnSingleDataTypeConfigureComplete(
- const DataTypeConfigurationStats& configuration_stats) {
+void DebugInfoEventListener::OnDataTypeConfigureComplete(
+ const std::vector<DataTypeConfigurationStats>& configuration_stats) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(ProtocolTypes().Has(configuration_stats.model_type));
-
- const DataTypeAssociationStats& association_stats =
- configuration_stats.association_stats;
-
- sync_pb::DebugEventInfo association_event;
- sync_pb::DatatypeAssociationStats* datatype_stats =
- association_event.mutable_datatype_association_stats();
- datatype_stats->set_data_type_id(
- GetSpecificsFieldNumberFromModelType(configuration_stats.model_type));
- datatype_stats->set_num_local_items_before_association(
- association_stats.num_local_items_before_association);
- datatype_stats->set_num_sync_items_before_association(
- association_stats.num_sync_items_before_association);
- datatype_stats->set_num_local_items_after_association(
- association_stats.num_local_items_after_association);
- datatype_stats->set_num_sync_items_after_association(
- association_stats.num_sync_items_after_association);
- datatype_stats->set_num_local_items_added(
- association_stats.num_local_items_added);
- datatype_stats->set_num_local_items_deleted(
- association_stats.num_local_items_deleted);
- datatype_stats->set_num_local_items_modified(
- association_stats.num_local_items_modified);
- datatype_stats->set_num_sync_items_added(
- association_stats.num_sync_items_added);
- datatype_stats->set_num_sync_items_deleted(
- association_stats.num_sync_items_deleted);
- datatype_stats->set_num_sync_items_modified(
- association_stats.num_sync_items_modified);
- datatype_stats->set_local_version_pre_association(
- association_stats.local_version_pre_association);
- datatype_stats->set_sync_version_pre_association(
- association_stats.sync_version_pre_association);
- datatype_stats->set_had_error(association_stats.had_error);
- datatype_stats->set_association_wait_time_for_same_priority_us(
- association_stats.association_wait_time.InMicroseconds());
- datatype_stats->set_association_time_us(
- association_stats.association_time.InMicroseconds());
- datatype_stats->set_download_wait_time_us(
- configuration_stats.download_wait_time.InMicroseconds());
- datatype_stats->set_download_time_us(
- configuration_stats.download_time.InMicroseconds());
- datatype_stats->set_association_wait_time_for_high_priority_us(
- configuration_stats.association_wait_time_for_high_priority
- .InMicroseconds());
-
- for (ModelTypeSet::Iterator it =
- configuration_stats.high_priority_types_configured_before.First();
- it.Good(); it.Inc()) {
- datatype_stats->add_high_priority_type_configured_before(
- GetSpecificsFieldNumberFromModelType(it.Get()));
- }
- for (ModelTypeSet::Iterator it =
- configuration_stats.same_priority_types_configured_before.First();
- it.Good(); it.Inc()) {
- datatype_stats->add_same_priority_type_configured_before(
- GetSpecificsFieldNumberFromModelType(it.Get()));
- }
+ for (size_t i = 0; i < configuration_stats.size(); ++i) {
+ DCHECK(ProtocolTypes().Has(configuration_stats[i].model_type));
+ const DataTypeAssociationStats& association_stats =
+ configuration_stats[i].association_stats;
+
+ sync_pb::DebugEventInfo association_event;
+ sync_pb::DatatypeAssociationStats* datatype_stats =
+ association_event.mutable_datatype_association_stats();
+ datatype_stats->set_data_type_id(
+ GetSpecificsFieldNumberFromModelType(
+ configuration_stats[i].model_type));
+ datatype_stats->set_num_local_items_before_association(
+ association_stats.num_local_items_before_association);
+ datatype_stats->set_num_sync_items_before_association(
+ association_stats.num_sync_items_before_association);
+ datatype_stats->set_num_local_items_after_association(
+ association_stats.num_local_items_after_association);
+ datatype_stats->set_num_sync_items_after_association(
+ association_stats.num_sync_items_after_association);
+ datatype_stats->set_num_local_items_added(
+ association_stats.num_local_items_added);
+ datatype_stats->set_num_local_items_deleted(
+ association_stats.num_local_items_deleted);
+ datatype_stats->set_num_local_items_modified(
+ association_stats.num_local_items_modified);
+ datatype_stats->set_num_sync_items_added(
+ association_stats.num_sync_items_added);
+ datatype_stats->set_num_sync_items_deleted(
+ association_stats.num_sync_items_deleted);
+ datatype_stats->set_num_sync_items_modified(
+ association_stats.num_sync_items_modified);
+ datatype_stats->set_local_version_pre_association(
+ association_stats.local_version_pre_association);
+ datatype_stats->set_sync_version_pre_association(
+ association_stats.sync_version_pre_association);
+ datatype_stats->set_had_error(association_stats.had_error);
+ datatype_stats->set_association_wait_time_for_same_priority_us(
+ association_stats.association_wait_time.InMicroseconds());
+ datatype_stats->set_association_time_us(
+ association_stats.association_time.InMicroseconds());
+ datatype_stats->set_download_wait_time_us(
+ configuration_stats[i].download_wait_time.InMicroseconds());
+ datatype_stats->set_download_time_us(
+ configuration_stats[i].download_time.InMicroseconds());
+ datatype_stats->set_association_wait_time_for_high_priority_us(
+ configuration_stats[i].association_wait_time_for_high_priority
+ .InMicroseconds());
+
+ for (ModelTypeSet::Iterator it =
+ configuration_stats[i].high_priority_types_configured_before
+ .First();
+ it.Good(); it.Inc()) {
+ datatype_stats->add_high_priority_type_configured_before(
+ GetSpecificsFieldNumberFromModelType(it.Get()));
+ }
- AddEventToQueue(association_event);
-}
+ for (ModelTypeSet::Iterator it =
+ configuration_stats[i].same_priority_types_configured_before
+ .First();
+ it.Good(); it.Inc()) {
+ datatype_stats->add_same_priority_type_configured_before(
+ GetSpecificsFieldNumberFromModelType(it.Get()));
+ }
-void DebugInfoEventListener::OnConfigureComplete() {
- DCHECK(thread_checker_.CalledOnValidThread());
- CreateAndAddEvent(sync_pb::DebugEventInfo::CONFIGURE_COMPLETE);
+ AddEventToQueue(association_event);
+ }
}
void DebugInfoEventListener::CreateAndAddEvent(
« no previous file with comments | « sync/internal_api/debug_info_event_listener.h ('k') | sync/internal_api/public/data_type_debug_info_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698