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

Unified Diff: content/browser/renderer_host/websocket_host.cc

Issue 791923003: replace COMPILE_ASSERT with static_assert in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixups Created 5 years, 11 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: content/browser/renderer_host/websocket_host.cc
diff --git a/content/browser/renderer_host/websocket_host.cc b/content/browser/renderer_host/websocket_host.cc
index 9b557fedab3d24d342b7a679f143a91b230aff63..84caa8cfb1157d3f0ee3c015e851be977879b449 100644
--- a/content/browser/renderer_host/websocket_host.cc
+++ b/content/browser/renderer_host/websocket_host.cc
@@ -40,15 +40,15 @@ net::WebSocketFrameHeader::OpCode MessageTypeToOpCode(
typedef net::WebSocketFrameHeader::OpCode OpCode;
// These compile asserts verify that the same underlying values are used for
// both types, so we can simply cast between them.
- COMPILE_ASSERT(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_CONTINUATION) ==
- net::WebSocketFrameHeader::kOpCodeContinuation,
- enum_values_must_match_for_opcode_continuation);
- COMPILE_ASSERT(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_TEXT) ==
- net::WebSocketFrameHeader::kOpCodeText,
- enum_values_must_match_for_opcode_text);
- COMPILE_ASSERT(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_BINARY) ==
- net::WebSocketFrameHeader::kOpCodeBinary,
- enum_values_must_match_for_opcode_binary);
+ static_assert(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_CONTINUATION) ==
+ net::WebSocketFrameHeader::kOpCodeContinuation,
+ "enum values must match for opcode continuation");
+ static_assert(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_TEXT) ==
+ net::WebSocketFrameHeader::kOpCodeText,
+ "enum values must match for opcode text");
+ static_assert(static_cast<OpCode>(WEB_SOCKET_MESSAGE_TYPE_BINARY) ==
+ net::WebSocketFrameHeader::kOpCodeBinary,
+ "enum values must match for opcode binary");
return static_cast<OpCode>(type);
}
@@ -57,7 +57,7 @@ WebSocketMessageType OpCodeToMessageType(
DCHECK(opCode == net::WebSocketFrameHeader::kOpCodeContinuation ||
opCode == net::WebSocketFrameHeader::kOpCodeText ||
opCode == net::WebSocketFrameHeader::kOpCodeBinary);
- // This cast is guaranteed valid by the COMPILE_ASSERT() statements above.
+ // This cast is guaranteed valid by the static_assert() statements above.
return static_cast<WebSocketMessageType>(opCode);
}
@@ -71,12 +71,12 @@ ChannelState StateCast(WebSocketDispatcherHost::WebSocketHostState host_state) {
host_state == WEBSOCKET_HOST_DELETED);
// These compile asserts verify that we can get away with using static_cast<>
// for the conversion.
- COMPILE_ASSERT(static_cast<ChannelState>(WEBSOCKET_HOST_ALIVE) ==
- net::WebSocketEventInterface::CHANNEL_ALIVE,
- enum_values_must_match_for_state_alive);
- COMPILE_ASSERT(static_cast<ChannelState>(WEBSOCKET_HOST_DELETED) ==
- net::WebSocketEventInterface::CHANNEL_DELETED,
- enum_values_must_match_for_state_deleted);
+ static_assert(static_cast<ChannelState>(WEBSOCKET_HOST_ALIVE) ==
+ net::WebSocketEventInterface::CHANNEL_ALIVE,
+ "enum values must match for state_alive");
+ static_assert(static_cast<ChannelState>(WEBSOCKET_HOST_DELETED) ==
+ net::WebSocketEventInterface::CHANNEL_DELETED,
+ "enum values must match for state_deleted");
return static_cast<ChannelState>(host_state);
}
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc ('k') | content/browser/speech/audio_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698