diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 01:35:30 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 01:35:30 +0000 |
commit | deb5740cb62d64c2e0b3746956fef66494fe49de (patch) | |
tree | 96917acb12243a0a9b3ff59f7e3425755aebe180 /chrome/common | |
parent | 083b0a6ce42c67ca904b025bef0c72b70e2de7b1 (diff) | |
download | chromium_src-deb5740cb62d64c2e0b3746956fef66494fe49de.zip chromium_src-deb5740cb62d64c2e0b3746956fef66494fe49de.tar.gz chromium_src-deb5740cb62d64c2e0b3746956fef66494fe49de.tar.bz2 |
Commit my changes that simplify automation message unpacking.
TBR=amit
Review URL: http://codereview.chromium.org/24002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/ipc_message_macros.h | 15 | ||||
-rw-r--r-- | chrome/common/ipc_message_utils.h | 48 |
2 files changed, 48 insertions, 15 deletions
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h index e723ffe..fe39efa 100644 --- a/chrome/common/ipc_message_macros.h +++ b/chrome/common/ipc_message_macros.h @@ -84,7 +84,6 @@ #undef IPC_MESSAGE_ROUTED4 #undef IPC_MESSAGE_ROUTED5 #undef IPC_MESSAGE_ROUTED6 -#undef IPC_MESSAGE_EMPTY #undef IPC_SYNC_MESSAGE_CONTROL0_0 #undef IPC_SYNC_MESSAGE_CONTROL0_1 #undef IPC_SYNC_MESSAGE_CONTROL0_2 @@ -178,9 +177,6 @@ #define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \ msg_class##__ID, -#define IPC_MESSAGE_EMPTY(msg_class) \ - msg_class##__ID, - #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ msg_class##__ID, @@ -427,9 +423,6 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ #define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \ IPC_MESSAGE_LOG(msg_class) -#define IPC_MESSAGE_EMPTY(msg_class) \ - IPC_MESSAGE_LOG(msg_class) - #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ IPC_MESSAGE_LOG(msg_class) @@ -683,14 +676,6 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \ routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5, arg6)) {} \ }; -// Dummy class for now, just to give us the ID field. -#define IPC_MESSAGE_EMPTY(msg_class) \ - class msg_class { \ - public: \ - enum { ID = msg_class##__ID }; \ - static void Log(const IPC::Message* msg, std::wstring* l) {} \ - }; - #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ public: \ diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h index d76e695..64f5653 100644 --- a/chrome/common/ipc_message_utils.h +++ b/chrome/common/ipc_message_utils.h @@ -1123,6 +1123,54 @@ class MessageWithTuple : public Message { if (Read(msg, &p)) LogParam(p, l); } + + // Functions used to do manual unpacking. Only used by the automation code, + // these should go away once that code uses SyncChannel. + template<typename TA, typename TB> + static bool Read(const IPC::Message* msg, TA* a, TB* b) { + ParamType params; + if (!Read(msg, ¶ms)) + return false; + *a = params.a; + *b = params.b; + return true; + } + + template<typename TA, typename TB, typename TC> + static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c) { + ParamType params; + if (!Read(msg, ¶ms)) + return false; + *a = params.a; + *b = params.b; + *c = params.c; + return true; + } + + template<typename TA, typename TB, typename TC, typename TD> + static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d) { + ParamType params; + if (!Read(msg, ¶ms)) + return false; + *a = params.a; + *b = params.b; + *c = params.c; + *d = params.d; + return true; + } + + template<typename TA, typename TB, typename TC, typename TD, typename TE> + static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d, TE* e) { + ParamType params; + if (!Read(msg, ¶ms)) + return false; + *a = params.a; + *b = params.b; + *c = params.c; + *d = params.d; + *e = params.e; + return true; + } }; // This class assumes that its template argument is a RefTuple (a Tuple with |