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 "google_apis/gcm/engine/registration_request.h" | 5 #include "google_apis/gcm/engine/registration_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 for (std::vector<std::string>::const_iterator iter = | 144 for (std::vector<std::string>::const_iterator iter = |
145 request_info_.sender_ids.begin(); | 145 request_info_.sender_ids.begin(); |
146 iter != request_info_.sender_ids.end(); | 146 iter != request_info_.sender_ids.end(); |
147 ++iter) { | 147 ++iter) { |
148 DCHECK(!iter->empty()); | 148 DCHECK(!iter->empty()); |
149 if (!senders.empty()) | 149 if (!senders.empty()) |
150 senders.append(","); | 150 senders.append(","); |
151 senders.append(*iter); | 151 senders.append(*iter); |
152 } | 152 } |
153 BuildFormEncoding(kSenderKey, senders, &body); | 153 BuildFormEncoding(kSenderKey, senders, &body); |
| 154 UMA_HISTOGRAM_COUNTS("GCM.RegistrationSenderIdCount", |
| 155 request_info_.sender_ids.size()); |
154 | 156 |
155 DVLOG(1) << "Performing registration for: " << request_info_.app_id; | 157 DVLOG(1) << "Performing registration for: " << request_info_.app_id; |
156 DVLOG(1) << "Registration request: " << body; | 158 DVLOG(1) << "Registration request: " << body; |
157 url_fetcher_->SetUploadData(kRegistrationRequestContentType, body); | 159 url_fetcher_->SetUploadData(kRegistrationRequestContentType, body); |
158 recorder_->RecordRegistrationSent(request_info_.app_id, senders); | 160 recorder_->RecordRegistrationSent(request_info_.app_id, senders); |
| 161 request_start_time_ = base::TimeTicks::Now(); |
159 url_fetcher_->Start(); | 162 url_fetcher_->Start(); |
160 } | 163 } |
161 | 164 |
162 void RegistrationRequest::RetryWithBackoff(bool update_backoff) { | 165 void RegistrationRequest::RetryWithBackoff(bool update_backoff) { |
163 if (update_backoff) { | 166 if (update_backoff) { |
164 DCHECK_GT(retries_left_, 0); | 167 DCHECK_GT(retries_left_, 0); |
165 --retries_left_; | 168 --retries_left_; |
166 url_fetcher_.reset(); | 169 url_fetcher_.reset(); |
167 backoff_entry_.InformOfRequest(false); | 170 backoff_entry_.InformOfRequest(false); |
168 } | 171 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 248 } |
246 | 249 |
247 status = REACHED_MAX_RETRIES; | 250 status = REACHED_MAX_RETRIES; |
248 recorder_->RecordRegistrationResponse( | 251 recorder_->RecordRegistrationResponse( |
249 request_info_.app_id, | 252 request_info_.app_id, |
250 request_info_.sender_ids, | 253 request_info_.sender_ids, |
251 status); | 254 status); |
252 RecordRegistrationStatusToUMA(status); | 255 RecordRegistrationStatusToUMA(status); |
253 } | 256 } |
254 | 257 |
| 258 if (status == SUCCESS) { |
| 259 UMA_HISTOGRAM_COUNTS("GCM.RegistrationRetryCount", |
| 260 backoff_entry_.failure_count()); |
| 261 UMA_HISTOGRAM_TIMES("GCM.RegistrationCompleteTime", |
| 262 base::TimeTicks::Now() - request_start_time_); |
| 263 } |
255 callback_.Run(status, token); | 264 callback_.Run(status, token); |
256 } | 265 } |
257 | 266 |
258 } // namespace gcm | 267 } // namespace gcm |
OLD | NEW |