From 94dc971dc40c6cfea33abd234e744ac314d0bc2a Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Sat, 5 Mar 2011 19:08:32 +0000 Subject: Move resource related IPCs to their own file in content. I added a IPC_STRUCT_TRAITS_PARENT macro to allow the automatic serializing macros to add a parent struct. TBR=tsepez Review URL: http://codereview.chromium.org/6628035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77048 0039d316-1c4b-4281-b951-d872f2087c98 --- ipc/ipc_message_macros.h | 8 +++++--- ipc/ipc_message_null_macros.h | 2 ++ ipc/ipc_message_utils.h | 1 + ipc/param_traits_log_macros.h | 6 ++++++ ipc/param_traits_macros.h | 1 + ipc/param_traits_read_macros.h | 2 ++ ipc/param_traits_write_macros.h | 2 ++ 7 files changed, 19 insertions(+), 3 deletions(-) (limited to 'ipc') diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index de1132e..b8885dc 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -130,9 +130,11 @@ // // Externally-defined structs are registered with IPC_STRUCT_TRAITS_BEGIN(), // IPC_STRUCT_TRAITS_MEMBER(), and IPC_STRUCT_TRAITS_END() macros. These -// cause registration of the types with message generation only. Note that -// IPC_STRUCT_TRAITS_MEMBER() is only permitted inside matching calls -// to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END(). +// cause registration of the types with message generation only. +// There's also IPC_STRUCT_TRAITS_PARENT, which is used to register a parent +// class (whose own traits are already defined). Note that +// IPC_STRUCT_TRAITS_MEMBER() and IPC_STRUCT_TRAITS_PARENT are only permitted +// inside matching calls to IPC_STRUCT_TRAITS_BEGIN() / IPC_STRUCT_TRAITS_END(). // // Enum types are registered with a single IPC_ENUM_TRAITS() macro. There // is no need to enumerate each value to the IPC mechanism. diff --git a/ipc/ipc_message_null_macros.h b/ipc/ipc_message_null_macros.h index 2c33172..fb57df5 100644 --- a/ipc/ipc_message_null_macros.h +++ b/ipc/ipc_message_null_macros.h @@ -11,6 +11,7 @@ #undef IPC_STRUCT_END #undef IPC_STRUCT_TRAITS_BEGIN #undef IPC_STRUCT_TRAITS_MEMBER +#undef IPC_STRUCT_TRAITS_PARENT #undef IPC_STRUCT_TRAITS_END #undef IPC_ENUM_TRAITS #undef IPC_MESSAGE_CONTROL0 @@ -91,6 +92,7 @@ #define IPC_STRUCT_END() #define IPC_STRUCT_TRAITS_BEGIN(struct_name) #define IPC_STRUCT_TRAITS_MEMBER(name) +#define IPC_STRUCT_TRAITS_PARENT(type) #define IPC_STRUCT_TRAITS_END() #define IPC_ENUM_TRAITS(enum_name) #define IPC_MESSAGE_CONTROL0(msg_class) diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index f7bf49a..800daaf 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -71,6 +71,7 @@ enum IPCMessageStart { SafeBrowsingMsgStart, P2PMsgStart, SocketStreamMsgStart, + ResourceMsgStart, }; class DictionaryValue; diff --git a/ipc/param_traits_log_macros.h b/ipc/param_traits_log_macros.h index 40f8ec4..de2006c 100644 --- a/ipc/param_traits_log_macros.h +++ b/ipc/param_traits_log_macros.h @@ -21,6 +21,7 @@ // Set up so next include will generate log methods. #undef IPC_STRUCT_TRAITS_BEGIN #undef IPC_STRUCT_TRAITS_MEMBER +#undef IPC_STRUCT_TRAITS_PARENT #undef IPC_STRUCT_TRAITS_END #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \ void ParamTraits::Log(const param_type& p, std::string* l) { \ @@ -31,6 +32,11 @@ l->append(", "); \ LogParam(p.name, l); \ needs_comma = true; +#define IPC_STRUCT_TRAITS_PARENT(type) \ + if (needs_comma) \ + l->append(", "); \ + ParamTraits::Log(p, l); \ + needs_comma = true; #define IPC_STRUCT_TRAITS_END() \ l->append(")"); \ } diff --git a/ipc/param_traits_macros.h b/ipc/param_traits_macros.h index f22376a5..df57adf 100644 --- a/ipc/param_traits_macros.h +++ b/ipc/param_traits_macros.h @@ -20,6 +20,7 @@ } #define IPC_STRUCT_TRAITS_MEMBER(name) +#define IPC_STRUCT_TRAITS_PARENT(type) #define IPC_STRUCT_TRAITS_END() // Traits generation for enums. diff --git a/ipc/param_traits_read_macros.h b/ipc/param_traits_read_macros.h index a4fc2f9..ffcdf8e 100644 --- a/ipc/param_traits_read_macros.h +++ b/ipc/param_traits_read_macros.h @@ -19,12 +19,14 @@ // Set up so next include will generate read methods. #undef IPC_STRUCT_TRAITS_BEGIN #undef IPC_STRUCT_TRAITS_MEMBER +#undef IPC_STRUCT_TRAITS_PARENT #undef IPC_STRUCT_TRAITS_END #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \ bool ParamTraits:: \ Read(const Message* m, void** iter, param_type* p) { \ return #define IPC_STRUCT_TRAITS_MEMBER(name) ReadParam(m, iter, &p->name) && +#define IPC_STRUCT_TRAITS_PARENT(type) ParamTraits::Read(m, iter, p) && #define IPC_STRUCT_TRAITS_END() 1; } #undef IPC_ENUM_TRAITS diff --git a/ipc/param_traits_write_macros.h b/ipc/param_traits_write_macros.h index 84e63f7..2ac5249 100644 --- a/ipc/param_traits_write_macros.h +++ b/ipc/param_traits_write_macros.h @@ -19,10 +19,12 @@ // Set up so next include will generate write methods. #undef IPC_STRUCT_TRAITS_BEGIN #undef IPC_STRUCT_TRAITS_MEMBER +#undef IPC_STRUCT_TRAITS_PARENT #undef IPC_STRUCT_TRAITS_END #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \ void ParamTraits::Write(Message* m, const param_type& p) { #define IPC_STRUCT_TRAITS_MEMBER(name) WriteParam(m, p.name); +#define IPC_STRUCT_TRAITS_PARENT(type) ParamTraits::Write(m, p); #define IPC_STRUCT_TRAITS_END() } #undef IPC_ENUM_TRAITS -- cgit v1.1