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/checkin_request.h" | 5 #include "google_apis/gcm/engine/checkin_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 case HTTP_BAD_REQUEST: | 51 case HTTP_BAD_REQUEST: |
52 return "HTTP_BAD_REQUEST"; | 52 return "HTTP_BAD_REQUEST"; |
53 case HTTP_UNAUTHORIZED: | 53 case HTTP_UNAUTHORIZED: |
54 return "HTTP_UNAUTHORIZED"; | 54 return "HTTP_UNAUTHORIZED"; |
55 case HTTP_NOT_OK: | 55 case HTTP_NOT_OK: |
56 return "HTTP_NOT_OK"; | 56 return "HTTP_NOT_OK"; |
57 case RESPONSE_PARSING_FAILED: | 57 case RESPONSE_PARSING_FAILED: |
58 return "RESPONSE_PARSING_FAILED"; | 58 return "RESPONSE_PARSING_FAILED"; |
59 case ZERO_ID_OR_TOKEN: | 59 case ZERO_ID_OR_TOKEN: |
60 return "ZERO_ID_OR_TOKEN"; | 60 return "ZERO_ID_OR_TOKEN"; |
61 default: | 61 case STATUS_COUNT: |
62 NOTREACHED(); | 62 NOTREACHED(); |
63 return "UNKNOWN_STATUS"; | 63 break; |
64 } | 64 } |
| 65 return "UNKNOWN_STATUS"; |
65 } | 66 } |
66 | 67 |
67 // Records checkin status to both stats recorder and reports to UMA. | 68 // Records checkin status to both stats recorder and reports to UMA. |
68 void RecordCheckinStatusAndReportUMA(CheckinRequestStatus status, | 69 void RecordCheckinStatusAndReportUMA(CheckinRequestStatus status, |
69 GCMStatsRecorder* recorder, | 70 GCMStatsRecorder* recorder, |
70 bool will_retry) { | 71 bool will_retry) { |
71 UMA_HISTOGRAM_ENUMERATION("GCM.CheckinRequestStatus", status, STATUS_COUNT); | 72 UMA_HISTOGRAM_ENUMERATION("GCM.CheckinRequestStatus", status, STATUS_COUNT); |
72 if (status == SUCCESS) | 73 if (status == SUCCESS) |
73 recorder->RecordCheckinSuccess(); | 74 recorder->RecordCheckinSuccess(); |
74 else { | 75 else { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 222 |
222 RecordCheckinStatusAndReportUMA(SUCCESS, recorder_, false); | 223 RecordCheckinStatusAndReportUMA(SUCCESS, recorder_, false); |
223 UMA_HISTOGRAM_COUNTS("GCM.CheckinRetryCount", | 224 UMA_HISTOGRAM_COUNTS("GCM.CheckinRetryCount", |
224 backoff_entry_.failure_count()); | 225 backoff_entry_.failure_count()); |
225 UMA_HISTOGRAM_TIMES("GCM.CheckinCompleteTime", | 226 UMA_HISTOGRAM_TIMES("GCM.CheckinCompleteTime", |
226 base::TimeTicks::Now() - request_start_time_); | 227 base::TimeTicks::Now() - request_start_time_); |
227 callback_.Run(response_proto); | 228 callback_.Run(response_proto); |
228 } | 229 } |
229 | 230 |
230 } // namespace gcm | 231 } // namespace gcm |
OLD | NEW |