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

Unified Diff: components/gcm_driver/gcm_client_impl.cc

Issue 2558553002: GCM: Add Android UMA, and UMA for deleted/collapsed messages (Closed)
Patch Set: Created 4 years 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: components/gcm_driver/gcm_client_impl.cc
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index bd44af2c7a28b9843ef1b504b8618534dac6cb39..731a724bb45b1d14c6436deb434393f2a3de98d2 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -82,6 +82,7 @@ enum ResetStoreError {
const char kGCMScope[] = "GCM";
const int kMaxRegistrationRetries = 5;
const int kMaxUnregistrationRetries = 5;
+const char kDeletedCountKey[] = "total_deleted";
const char kMessageTypeDataMessage[] = "gcm";
const char kMessageTypeDeletedMessagesKey[] = "deleted_messages";
const char kMessageTypeKey[] = "message_type";
@@ -1334,12 +1335,21 @@ void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) {
HandleIncomingDataMessage(app_id, use_subtype, data_message_stanza,
message_data);
break;
- case DELETED_MESSAGES:
+ case DELETED_MESSAGES: {
+ int deleted_count = 0;
+ MessageData::iterator count_iter = message_data.find(kDeletedCountKey);
+ if (count_iter != message_data.end()) {
+ if (!base::StringToInt(count_iter->second, &deleted_count))
+ deleted_count = 0;
+ }
recorder_.RecordDataMessageReceived(app_id, data_message_stanza.from(),
data_message_stanza.ByteSize(), true,
- GCMStatsRecorder::DELETED_MESSAGES);
+ GCMStatsRecorder::DELETED_MESSAGES,
+ false /* has_collapse_key */,
+ deleted_count);
delegate_->OnMessagesDeleted(app_id);
Peter Beverloo 2016/12/07 13:44:12 nit: please split this block out into an HandleInc
johnme 2016/12/07 14:29:16 Done.
break;
+ }
case SEND_ERROR:
HandleIncomingSendError(app_id, data_message_stanza, message_data);
break;
@@ -1401,9 +1411,11 @@ void GCMClientImpl::HandleIncomingDataMessage(
}
}
- recorder_.RecordDataMessageReceived(app_id, sender,
- data_message_stanza.ByteSize(), registered,
- GCMStatsRecorder::DATA_MESSAGE);
+ recorder_.RecordDataMessageReceived(
+ app_id, sender, data_message_stanza.ByteSize(), registered,
+ GCMStatsRecorder::DATA_MESSAGE,
+ data_message_stanza.has_token() && !data_message_stanza.token().empty(),
+ 0 /* deleted_count */);
if (!registered)
return;
« no previous file with comments | « no previous file | components/gcm_driver/gcm_stats_recorder_impl.h » ('j') | components/gcm_driver/gcm_stats_recorder_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698