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

Unified Diff: google_apis/gcm/gcm_client_impl.cc

Issue 248213004: Record connection, registration, and receiving activities. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 8 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
« no previous file with comments | « google_apis/gcm/gcm_client_impl.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..46295bd18f19c4597093b5f8abbf7a0a8c4da1c3 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();
}
@@ -489,7 +493,8 @@ void GCMClientImpl::Unregister(const std::string& app_id) {
base::Bind(&GCMClientImpl::OnUnregisterCompleted,
weak_ptr_factory_.GetWeakPtr(),
app_id),
- url_request_context_getter_);
+ url_request_context_getter_,
+ &recorder_);
pending_unregistration_requests_[app_id] = unregistration_request;
unregistration_request->Start();
}
@@ -583,7 +588,7 @@ 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.recorded_activities);
for (RegistrationInfoMap::const_iterator it = registrations_.begin();
it != registrations_.end(); ++it) {
@@ -667,6 +672,11 @@ void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) {
HandleIncomingDataMessage(data_message_stanza, message_data);
break;
case DELETED_MESSAGES:
+ recorder_.RecordDataMessageRecieved(data_message_stanza.category(),
+ data_message_stanza.from(),
+ data_message_stanza.ByteSize(),
+ true,
+ GCMStatsRecorder::DELETED_MESSAGES);
delegate_->OnMessagesDeleted(data_message_stanza.category());
break;
case SEND_ERROR:
@@ -688,10 +698,15 @@ void GCMClientImpl::HandleIncomingDataMessage(
// Drop the message when the app is not registered for the sender of the
// message.
RegistrationInfoMap::iterator iter = registrations_.find(app_id);
- if (iter == registrations_.end() ||
+ bool not_registered =
+ iter == registrations_.end() ||
std::find(iter->second->sender_ids.begin(),
iter->second->sender_ids.end(),
- data_message_stanza.from()) == iter->second->sender_ids.end()) {
+ data_message_stanza.from()) == iter->second->sender_ids.end();
+ recorder_.RecordDataMessageRecieved(app_id, data_message_stanza.from(),
+ data_message_stanza.ByteSize(), !not_registered,
+ GCMStatsRecorder::DATA_MESSAGE);
+ if (not_registered) {
return;
}
« no previous file with comments | « google_apis/gcm/gcm_client_impl.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698