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

Side by Side Diff: google_apis/gcm/engine/checkin_request.cc

Issue 2427633005: Improve GCM enum switch type safety (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/account_mapping.cc ('k') | google_apis/gcm/engine/connection_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698