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

Unified Diff: google_apis/gcm/engine/unregistration_request.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
Index: google_apis/gcm/engine/unregistration_request.cc
diff --git a/google_apis/gcm/engine/unregistration_request.cc b/google_apis/gcm/engine/unregistration_request.cc
index 2553a556b078321a199472bfe5fd83b632d37361..dbcce84ecdb4e721c72ab3aff8872dc711dc6c49 100644
--- a/google_apis/gcm/engine/unregistration_request.cc
+++ b/google_apis/gcm/engine/unregistration_request.cc
@@ -10,6 +10,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
+#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
#include "net/base/escape.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
@@ -115,11 +116,13 @@ UnregistrationRequest::UnregistrationRequest(
const RequestInfo& request_info,
const net::BackoffEntry::Policy& backoff_policy,
const UnregistrationCallback& callback,
- scoped_refptr<net::URLRequestContextGetter> request_context_getter)
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter,
+ GCMStatsRecorder* recorder)
: callback_(callback),
request_info_(request_info),
backoff_entry_(&backoff_policy),
request_context_getter_(request_context_getter),
+ recorder_(recorder),
weak_ptr_factory_(this) {
}
@@ -156,6 +159,7 @@ void UnregistrationRequest::Start() {
url_fetcher_->SetUploadData(kRequestContentType, body);
DVLOG(1) << "Performing unregistration for: " << request_info_.app_id;
+ recorder_->RecordUnregistrationSent(request_info_.app_id);
url_fetcher_->Start();
}
@@ -170,6 +174,9 @@ void UnregistrationRequest::RetryWithBackoff(bool update_backoff) {
<< request_info_.app_id << ", for "
<< backoff_entry_.GetTimeUntilRelease().InMilliseconds()
<< " milliseconds.";
+ recorder_->RecordUnregistrationRetryDelayed(
+ request_info_.app_id,
+ backoff_entry_.GetTimeUntilRelease().InMilliseconds());
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&UnregistrationRequest::RetryWithBackoff,
@@ -190,6 +197,7 @@ void UnregistrationRequest::OnURLFetchComplete(const net::URLFetcher* source) {
UMA_HISTOGRAM_ENUMERATION("GCM.UnregistrationRequestStatus",
status,
UNREGISTRATION_STATUS_COUNT);
+ recorder_->RecordUnregistrationResponse(request_info_.app_id, status);
if (status == URL_FETCHING_FAILED ||
status == SERVICE_UNAVAILABLE ||
« no previous file with comments | « google_apis/gcm/engine/unregistration_request.h ('k') | google_apis/gcm/engine/unregistration_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698