Index: google_apis/gcm/gcm_client_impl.cc |
diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc |
index e152d631cfd7ddf6666266bd44c26d5f28078341..bd19cd0bff1fb532548c1e9321aaa20d23dffed9 100644 |
--- a/google_apis/gcm/gcm_client_impl.cc |
+++ b/google_apis/gcm/gcm_client_impl.cc |
@@ -146,12 +146,14 @@ scoped_ptr<ConnectionFactory> GCMInternalsBuilder::BuildConnectionFactory( |
const std::vector<GURL>& endpoints, |
const net::BackoffEntry::Policy& backoff_policy, |
scoped_refptr<net::HttpNetworkSession> network_session, |
- net::NetLog* net_log) { |
+ net::NetLog* net_log, |
+ GCMStatsRecorder* recorder) { |
return make_scoped_ptr<ConnectionFactory>( |
new ConnectionFactoryImpl(endpoints, |
backoff_policy, |
network_session, |
- net_log)); |
+ net_log, |
+ recorder)); |
} |
GCMClientImpl::GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder) |
@@ -240,7 +242,8 @@ void GCMClientImpl::InitializeMCSClient( |
endpoints, |
kDefaultBackoffPolicy, |
network_session_, |
- net_log_.net_log()); |
+ net_log_.net_log(), |
+ &recorder_); |
mcs_client_ = internals_builder_->BuildMCSClient( |
chrome_build_proto_.chrome_version(), |
clock_.get(), |
@@ -417,7 +420,8 @@ void GCMClientImpl::Register(const std::string& app_id, |
app_id, |
sender_ids), |
kMaxRegistrationRetries, |
- url_request_context_getter_); |
+ url_request_context_getter_, |
+ &recorder_); |
pending_registration_requests_[app_id] = registration_request; |
registration_request->Start(); |
} |
@@ -583,7 +587,10 @@ GCMClient::GCMStatistics GCMClientImpl::GetStatistics() const { |
} |
if (device_checkin_info_.android_id > 0) |
stats.android_id = device_checkin_info_.android_id; |
- recorder_.CollectSendingActivities(&stats.sending_activities); |
+ recorder_.CollectActivities(&stats.connection_activities, |
+ &stats.registration_activities, |
+ &stats.receiving_activities, |
+ &stats.sending_activities); |
for (RegistrationInfoMap::const_iterator it = registrations_.begin(); |
it != registrations_.end(); ++it) { |
@@ -667,6 +674,9 @@ void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) { |
HandleIncomingDataMessage(data_message_stanza, message_data); |
break; |
case DELETED_MESSAGES: |
+ recorder_.RecordDataDeletedMessage(data_message_stanza.category(), |
+ data_message_stanza.from(), |
+ data_message_stanza.ByteSize()); |
delegate_->OnMessagesDeleted(data_message_stanza.category()); |
break; |
case SEND_ERROR: |
@@ -692,6 +702,8 @@ void GCMClientImpl::HandleIncomingDataMessage( |
std::find(iter->second->sender_ids.begin(), |
iter->second->sender_ids.end(), |
data_message_stanza.from()) == iter->second->sender_ids.end()) { |
+ recorder_.RecordDataRecieved(app_id, data_message_stanza.from(), |
+ data_message_stanza.ByteSize(), false); |
return; |
} |
@@ -700,6 +712,8 @@ void GCMClientImpl::HandleIncomingDataMessage( |
if (data_message_stanza.has_token()) |
incoming_message.collapse_key = data_message_stanza.token(); |
incoming_message.data = message_data; |
+ recorder_.RecordDataRecieved(app_id, data_message_stanza.from(), |
jianli
2014/04/23 17:22:35
You can combine both recording into one by introdu
juyik
2014/04/23 21:36:56
Done.
|
+ data_message_stanza.ByteSize(), true); |
delegate_->OnMessageReceived(app_id, incoming_message); |
} |