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

Unified Diff: ipc/param_traits_write_macros.h

Issue 15841011: Implement off-the-wire validation scheme for enum types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add () around macro parameter. Created 7 years, 7 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 | « ipc/param_traits_read_macros.h ('k') | ipc/struct_constructor_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/param_traits_write_macros.h
diff --git a/ipc/param_traits_write_macros.h b/ipc/param_traits_write_macros.h
index dd977cde8d8ace40a3251025e541f678c4f20a53..81f915ffff8dedf95bb36766f779fc1bc05d93f3 100644
--- a/ipc/param_traits_write_macros.h
+++ b/ipc/param_traits_write_macros.h
@@ -9,13 +9,11 @@
#include "ipc/ipc_message_null_macros.h"
// STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur.
-#undef IPC_STRUCT_BEGIN
#undef IPC_STRUCT_BEGIN_WITH_PARENT
#undef IPC_STRUCT_MEMBER
#undef IPC_STRUCT_END
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
- IPC_STRUCT_BEGIN(struct_name)
-#define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
+ IPC_STRUCT_TRAITS_BEGIN(struct_name)
#define IPC_STRUCT_MEMBER(type, name, ...) IPC_STRUCT_TRAITS_MEMBER(name)
#define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
@@ -30,10 +28,11 @@
#define IPC_STRUCT_TRAITS_PARENT(type) ParamTraits<type>::Write(m, p);
#define IPC_STRUCT_TRAITS_END() }
-#undef IPC_ENUM_TRAITS
-#define IPC_ENUM_TRAITS(enum_name) \
- void ParamTraits<enum_name>::Write(Message* m, const param_type& p) { \
- m->WriteInt(static_cast<int>(p)); \
+#undef IPC_ENUM_TRAITS_VALIDATE
+#define IPC_ENUM_TRAITS_VALIDATE(enum_name, validation_expression) \
+ void ParamTraits<enum_name>::Write(Message* m, const param_type& value) { \
+ DCHECK(validation_expression); \
+ m->WriteInt(static_cast<int>(value)); \
}
#endif // IPC_PARAM_TRAITS_WRITE_MACROS_H_
« no previous file with comments | « ipc/param_traits_read_macros.h ('k') | ipc/struct_constructor_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698