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

Unified Diff: components/gcm_driver/gcm_stats_recorder_impl.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/gcm_driver/gcm_desktop_utils.cc ('k') | components/gcm_driver/instance_id/instance_id_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_stats_recorder_impl.cc
diff --git a/components/gcm_driver/gcm_stats_recorder_impl.cc b/components/gcm_driver/gcm_stats_recorder_impl.cc
index 719f25383d31e19d15e269b015a90aad92b34954..8294dd18f8daa16ebeadcb29462999f2822b840e 100644
--- a/components/gcm_driver/gcm_stats_recorder_impl.cc
+++ b/components/gcm_driver/gcm_stats_recorder_impl.cc
@@ -50,10 +50,11 @@ std::string GetMessageSendStatusString(
return "NO_CONNECTION_ON_ZERO_TTL";
case gcm::MCSClient::TTL_EXCEEDED:
return "TTL_EXCEEDED";
- default:
+ case gcm::MCSClient::SEND_STATUS_COUNT:
NOTREACHED();
- return "UNKNOWN";
+ break;
}
+ return "UNKNOWN";
}
// Helper for getting string representation of the
@@ -71,10 +72,13 @@ std::string GetConnectionResetReasonString(
return "SOCKET_FAILURE";
case gcm::ConnectionFactory::NETWORK_CHANGE:
return "NETWORK_CHANGE";
- default:
+ case gcm::ConnectionFactory::NEW_HEARTBEAT_INTERVAL:
+ return "NEW_HEARTBEAT_INTERVAL";
+ case gcm::ConnectionFactory::CONNECTION_RESET_COUNT:
NOTREACHED();
- return "UNKNOWN_REASON";
+ break;
}
+ return "UNKNOWN_REASON";
}
// Helper for getting string representation of the RegistrationRequest::Status
@@ -102,10 +106,11 @@ std::string GetRegistrationStatusString(
return "RESPONSE_PARSING_FAILED";
case gcm::RegistrationRequest::REACHED_MAX_RETRIES:
return "REACHED_MAX_RETRIES";
- default:
+ case gcm::RegistrationRequest::STATUS_COUNT:
NOTREACHED();
- return "UNKNOWN_STATUS";
+ break;
}
+ return "UNKNOWN_STATUS";
}
// Helper for getting string representation of the RegistrationRequest::Status
@@ -135,10 +140,11 @@ std::string GetUnregistrationStatusString(
return "UNKNOWN_ERROR";
case gcm::UnregistrationRequest::REACHED_MAX_RETRIES:
return "REACHED_MAX_RETRIES";
- default:
+ case gcm::UnregistrationRequest::UNREGISTRATION_STATUS_COUNT:
NOTREACHED();
- return "UNKNOWN_STATUS";
+ break;
}
+ return "UNKNOWN_STATUS";
}
} // namespace
@@ -444,7 +450,7 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived(
"Data msg received",
"No such registered app found");
} else {
- switch(message_type) {
+ switch (message_type) {
case GCMStatsRecorderImpl::DATA_MESSAGE:
RecordReceiving(app_id, from, message_byte_size, "Data msg received",
std::string());
@@ -453,8 +459,6 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived(
RecordReceiving(app_id, from, message_byte_size, "Data msg received",
"Message has been deleted on server");
break;
- default:
- NOTREACHED();
}
}
}
« no previous file with comments | « components/gcm_driver/gcm_desktop_utils.cc ('k') | components/gcm_driver/instance_id/instance_id_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698