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

Unified Diff: content/renderer/pepper/event_conversion.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
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/event_conversion.cc
diff --git a/content/renderer/pepper/event_conversion.cc b/content/renderer/pepper/event_conversion.cc
index 4de55559fff5dedd8d70789f20f38cc8992040cb..164e33e40ee905ed1f3528a11865a5d7d13a7fd3 100644
--- a/content/renderer/pepper/event_conversion.cc
+++ b/content/renderer/pepper/event_conversion.cc
@@ -40,45 +40,45 @@ namespace {
// Verify the modifier flags WebKit uses match the Pepper ones. If these start
// not matching, we'll need to write conversion code to preserve the Pepper
// values (since plugins will be depending on them).
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_SHIFTKEY) ==
- static_cast<int>(WebInputEvent::ShiftKey),
- ShiftKeyMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_CONTROLKEY) ==
- static_cast<int>(WebInputEvent::ControlKey),
- ControlKeyMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_ALTKEY) ==
- static_cast<int>(WebInputEvent::AltKey),
- AltKeyMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_METAKEY) ==
- static_cast<int>(WebInputEvent::MetaKey),
- MetaKeyMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISKEYPAD) ==
- static_cast<int>(WebInputEvent::IsKeyPad),
- KeyPadMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT) ==
- static_cast<int>(WebInputEvent::IsAutoRepeat),
- AutoRepeatMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN) ==
- static_cast<int>(WebInputEvent::LeftButtonDown),
- LeftButtonMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN) ==
- static_cast<int>(WebInputEvent::MiddleButtonDown),
- MiddleButtonMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN) ==
- static_cast<int>(WebInputEvent::RightButtonDown),
- RightButtonMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY) ==
- static_cast<int>(WebInputEvent::CapsLockOn),
- CapsLockMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) ==
- static_cast<int>(WebInputEvent::NumLockOn),
- NumLockMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISLEFT) ==
- static_cast<int>(WebInputEvent::IsLeft),
- LeftMatches);
-COMPILE_ASSERT(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISRIGHT) ==
- static_cast<int>(WebInputEvent::IsRight),
- RightMatches);
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_SHIFTKEY) ==
+ static_cast<int>(WebInputEvent::ShiftKey),
+ "ShiftKey should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_CONTROLKEY) ==
+ static_cast<int>(WebInputEvent::ControlKey),
+ "ControlKey should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ALTKEY) ==
+ static_cast<int>(WebInputEvent::AltKey),
+ "AltKey should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_METAKEY) ==
+ static_cast<int>(WebInputEvent::MetaKey),
+ "MetaKey should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISKEYPAD) ==
+ static_cast<int>(WebInputEvent::IsKeyPad),
+ "KeyPad should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT) ==
+ static_cast<int>(WebInputEvent::IsAutoRepeat),
+ "AutoRepeat should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN) ==
+ static_cast<int>(WebInputEvent::LeftButtonDown),
+ "LeftButton should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN) ==
+ static_cast<int>(WebInputEvent::MiddleButtonDown),
+ "MiddleButton should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN) ==
+ static_cast<int>(WebInputEvent::RightButtonDown),
+ "RightButton should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY) ==
+ static_cast<int>(WebInputEvent::CapsLockOn),
+ "CapsLock should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) ==
+ static_cast<int>(WebInputEvent::NumLockOn),
+ "NumLock should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISLEFT) ==
+ static_cast<int>(WebInputEvent::IsLeft),
+ "IsLeft should match");
+static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISRIGHT) ==
+ static_cast<int>(WebInputEvent::IsRight),
+ "IsRight should match");
PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) {
switch (wetype) {
@@ -169,18 +169,18 @@ void AppendCharEvent(const WebInputEvent& event,
void AppendMouseEvent(const WebInputEvent& event,
std::vector<InputEventData>* result_events) {
- COMPILE_ASSERT(static_cast<int>(WebMouseEvent::ButtonNone) ==
- static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_NONE),
- MouseNone);
- COMPILE_ASSERT(static_cast<int>(WebMouseEvent::ButtonLeft) ==
- static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_LEFT),
- MouseLeft);
- COMPILE_ASSERT(static_cast<int>(WebMouseEvent::ButtonRight) ==
- static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT),
- MouseRight);
- COMPILE_ASSERT(static_cast<int>(WebMouseEvent::ButtonMiddle) ==
- static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE),
- MouseMiddle);
+ static_assert(static_cast<int>(WebMouseEvent::ButtonNone) ==
+ static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_NONE),
+ "MouseNone should match");
+ static_assert(static_cast<int>(WebMouseEvent::ButtonLeft) ==
+ static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_LEFT),
+ "MouseLeft should match");
+ static_assert(static_cast<int>(WebMouseEvent::ButtonRight) ==
+ static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT),
+ "MouseRight should match");
+ static_assert(static_cast<int>(WebMouseEvent::ButtonMiddle) ==
+ static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE),
+ "MouseMiddle should match");
const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event);
InputEventData result = GetEventWithCommonFieldsAndType(event);
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698