OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" | 5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void GCMStatsRecorderImpl::RecordConnectionResetSignaled( | 265 void GCMStatsRecorderImpl::RecordConnectionResetSignaled( |
266 ConnectionFactory::ConnectionResetReason reason) { | 266 ConnectionFactory::ConnectionResetReason reason) { |
267 if (!is_recording_) | 267 if (!is_recording_) |
268 return; | 268 return; |
269 RecordConnection("Connection reset", | 269 RecordConnection("Connection reset", |
270 GetConnectionResetReasonString(reason)); | 270 GetConnectionResetReasonString(reason)); |
271 } | 271 } |
272 | 272 |
273 void GCMStatsRecorderImpl::RecordRegistration( | 273 void GCMStatsRecorderImpl::RecordRegistration( |
274 const std::string& app_id, | 274 const std::string& app_id, |
275 const std::string& sender_ids, | 275 const std::string& senders, |
276 const std::string& event, | 276 const std::string& event, |
277 const std::string& details) { | 277 const std::string& details) { |
278 RegistrationActivity data; | 278 RegistrationActivity data; |
279 RegistrationActivity* inserted_data = InsertCircularBuffer( | 279 RegistrationActivity* inserted_data = InsertCircularBuffer( |
280 ®istration_activities_, data); | 280 ®istration_activities_, data); |
281 inserted_data->app_id = app_id; | 281 inserted_data->app_id = app_id; |
282 inserted_data->sender_ids = sender_ids; | 282 inserted_data->sender_ids = senders; |
283 inserted_data->event = event; | 283 inserted_data->event = event; |
284 inserted_data->details = details; | 284 inserted_data->details = details; |
285 NotifyActivityRecorded(); | 285 NotifyActivityRecorded(); |
286 } | 286 } |
287 | 287 |
288 void GCMStatsRecorderImpl::RecordRegistrationSent( | 288 void GCMStatsRecorderImpl::RecordRegistrationSent( |
289 const std::string& app_id, | 289 const std::string& app_id, |
290 const std::string& sender_ids) { | 290 const std::string& sender_ids) { |
291 UMA_HISTOGRAM_COUNTS("GCM.RegistrationRequest", 1); | 291 UMA_HISTOGRAM_COUNTS("GCM.RegistrationRequest", 1); |
292 if (!is_recording_) | 292 if (!is_recording_) |
293 return; | 293 return; |
294 RecordRegistration(app_id, sender_ids, | 294 RecordRegistration(app_id, sender_ids, |
295 "Registration request sent", std::string()); | 295 "Registration request sent", std::string()); |
296 } | 296 } |
297 | 297 |
298 void GCMStatsRecorderImpl::RecordRegistrationResponse( | 298 void GCMStatsRecorderImpl::RecordRegistrationResponse( |
299 const std::string& app_id, | 299 const std::string& app_id, |
300 const std::vector<std::string>& sender_ids, | 300 const std::string& senders, |
301 RegistrationRequest::Status status) { | 301 RegistrationRequest::Status status) { |
302 if (!is_recording_) | 302 if (!is_recording_) |
303 return; | 303 return; |
304 RecordRegistration(app_id, JoinString(sender_ids, ","), | 304 RecordRegistration(app_id, senders, |
305 "Registration response received", | 305 "Registration response received", |
306 GetRegistrationStatusString(status)); | 306 GetRegistrationStatusString(status)); |
307 } | 307 } |
308 | 308 |
309 void GCMStatsRecorderImpl::RecordRegistrationRetryRequested( | 309 void GCMStatsRecorderImpl::RecordRegistrationRetryRequested( |
310 const std::string& app_id, | 310 const std::string& app_id, |
311 const std::vector<std::string>& sender_ids, | 311 const std::string& senders, |
312 int retries_left) { | 312 int retries_left) { |
313 if (!is_recording_) | 313 if (!is_recording_) |
314 return; | 314 return; |
315 RecordRegistration(app_id, JoinString(sender_ids, ","), | 315 RecordRegistration(app_id, senders, |
316 "Registration retry requested", | 316 "Registration retry requested", |
317 base::StringPrintf("Retries left: %d", retries_left)); | 317 base::StringPrintf("Retries left: %d", retries_left)); |
318 } | 318 } |
319 | 319 |
320 void GCMStatsRecorderImpl::RecordUnregistrationSent( | 320 void GCMStatsRecorderImpl::RecordUnregistrationSent( |
321 const std::string& app_id) { | 321 const std::string& app_id) { |
322 UMA_HISTOGRAM_COUNTS("GCM.UnregistrationRequest", 1); | 322 UMA_HISTOGRAM_COUNTS("GCM.UnregistrationRequest", 1); |
323 if (!is_recording_) | 323 if (!is_recording_) |
324 return; | 324 return; |
325 RecordRegistration(app_id, std::string(), "Unregistration request sent", | 325 RecordRegistration(app_id, std::string(), "Unregistration request sent", |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 const std::string& receiver_id, | 505 const std::string& receiver_id, |
506 const std::string& message_id) { | 506 const std::string& message_id) { |
507 UMA_HISTOGRAM_COUNTS("GCM.IncomingSendErrors", 1); | 507 UMA_HISTOGRAM_COUNTS("GCM.IncomingSendErrors", 1); |
508 if (!is_recording_) | 508 if (!is_recording_) |
509 return; | 509 return; |
510 RecordSending(app_id, receiver_id, message_id, "Received 'send error' msg", | 510 RecordSending(app_id, receiver_id, message_id, "Received 'send error' msg", |
511 std::string()); | 511 std::string()); |
512 } | 512 } |
513 | 513 |
514 } // namespace gcm | 514 } // namespace gcm |
OLD | NEW |