summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authordimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 18:35:16 +0000
committerdimich@google.com <dimich@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 18:35:16 +0000
commita021b2e246b164ef6a4911d79d38df0fd14fd38b (patch)
treef4fd62c0b53caa886de5d2c94c75b7a5abd55e44 /chrome/common
parentff9b3fd329d6660386ea34be83441e477e682ca9 (diff)
downloadchromium_src-a021b2e246b164ef6a4911d79d38df0fd14fd38b.zip
chromium_src-a021b2e246b164ef6a4911d79d38df0fd14fd38b.tar.gz
chromium_src-a021b2e246b164ef6a4911d79d38df0fd14fd38b.tar.bz2
Remove 6- and 7-parameter IPC message macros. Replace with a struct that packs parameters.
BUG=16685 TEST=none Review URL: http://codereview.chromium.org/149775 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/ipc_message_macros.h45
-rw-r--r--chrome/common/ipc_message_utils.h74
-rw-r--r--chrome/common/worker_messages.h60
-rw-r--r--chrome/common/worker_messages_internal.h10
4 files changed, 62 insertions, 127 deletions
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h
index 4839ecd..f3c9278 100644
--- a/chrome/common/ipc_message_macros.h
+++ b/chrome/common/ipc_message_macros.h
@@ -95,8 +95,6 @@
#undef IPC_MESSAGE_ROUTED3
#undef IPC_MESSAGE_ROUTED4
#undef IPC_MESSAGE_ROUTED5
-#undef IPC_MESSAGE_ROUTED6
-#undef IPC_MESSAGE_ROUTED7
#undef IPC_SYNC_MESSAGE_CONTROL0_0
#undef IPC_SYNC_MESSAGE_CONTROL0_1
#undef IPC_SYNC_MESSAGE_CONTROL0_2
@@ -190,12 +188,6 @@
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
msg_class##__ID,
-#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
- msg_class##__ID,
-
-#define IPC_MESSAGE_ROUTED7(msg_class, type1, type2, type3, type4, type5, type6, type7) \
- msg_class##__ID,
-
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
msg_class##__ID,
@@ -466,12 +458,6 @@ LogFunction g_log_function_mapping[LastMsgIndex];
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
IPC_MESSAGE_LOG(msg_class)
-#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
- IPC_MESSAGE_LOG(msg_class)
-
-#define IPC_MESSAGE_ROUTED7(msg_class, type1, type2, type3, type4, type5, type6, type7) \
- IPC_MESSAGE_LOG(msg_class)
-
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
IPC_MESSAGE_LOG(msg_class)
@@ -720,37 +706,6 @@ LogFunction g_log_function_mapping[LastMsgIndex];
routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5)) {} \
};
-#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, \
- type6) \
- class msg_class : \
- public IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \
- type6> > { \
- public: \
- enum { ID = msg_class##__ID }; \
- msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
- const type3& arg3, const type4& arg4, const type5& arg5, \
- const type6& arg6) \
- : IPC::MessageWithTuple< Tuple6<type1, type2, type3, type4, type5, \
- type6> >( \
- routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5, arg6)) {} \
- };
-
-#define IPC_MESSAGE_ROUTED7(msg_class, type1, type2, type3, type4, type5, \
- type6, type7) \
- class msg_class : \
- public IPC::MessageWithTuple< Tuple7<type1, type2, type3, type4, type5, \
- type6, type7> > { \
- public: \
- enum { ID = msg_class##__ID }; \
- msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
- const type3& arg3, const type4& arg4, const type5& arg5, \
- const type6& arg6, const type7& arg7) \
- : IPC::MessageWithTuple< Tuple7<type1, type2, type3, type4, type5, \
- type6, type7> >( \
- routing_id, ID, MakeRefTuple(arg1, arg2, arg3, arg4, arg5, \
- arg6, arg7)) {} \
- };
-
#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 807fd9f..c6222e8 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -1142,80 +1142,6 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > {
}
};
-template <class A, class B, class C, class D, class E, class F>
-struct ParamTraits< Tuple6<A, B, C, D, E, F> > {
- typedef Tuple6<A, B, C, D, E, F> param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
- WriteParam(m, p.c);
- WriteParam(m, p.d);
- WriteParam(m, p.e);
- WriteParam(m, p.f);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b) &&
- ReadParam(m, iter, &r->c) &&
- ReadParam(m, iter, &r->d) &&
- ReadParam(m, iter, &r->e) &&
- ReadParam(m, iter, &r->f));
- }
- static void Log(const param_type& p, std::wstring* l) {
- LogParam(p.a, l);
- l->append(L", ");
- LogParam(p.b, l);
- l->append(L", ");
- LogParam(p.c, l);
- l->append(L", ");
- LogParam(p.d, l);
- l->append(L", ");
- LogParam(p.e, l);
- l->append(L", ");
- LogParam(p.f, l);
- }
-};
-
-template <class A, class B, class C, class D, class E, class F, class G>
-struct ParamTraits< Tuple7<A, B, C, D, E, F, G> > {
- typedef Tuple7<A, B, C, D, E, F, G> param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
- WriteParam(m, p.c);
- WriteParam(m, p.d);
- WriteParam(m, p.e);
- WriteParam(m, p.f);
- WriteParam(m, p.g);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b) &&
- ReadParam(m, iter, &r->c) &&
- ReadParam(m, iter, &r->d) &&
- ReadParam(m, iter, &r->e) &&
- ReadParam(m, iter, &r->f) &&
- ReadParam(m, iter, &r->g));
- }
- static void Log(const param_type& p, std::wstring* l) {
- LogParam(p.a, l);
- l->append(L", ");
- LogParam(p.b, l);
- l->append(L", ");
- LogParam(p.c, l);
- l->append(L", ");
- LogParam(p.d, l);
- l->append(L", ");
- LogParam(p.e, l);
- l->append(L", ");
- LogParam(p.f, l);
- l->append(L", ");
- LogParam(p.g, l);
- }
-};
-
-
-
//-----------------------------------------------------------------------------
// Generic message subclasses
diff --git a/chrome/common/worker_messages.h b/chrome/common/worker_messages.h
index c1fde97..f7a7c9cc 100644
--- a/chrome/common/worker_messages.h
+++ b/chrome/common/worker_messages.h
@@ -13,6 +13,66 @@
#include "base/basictypes.h"
#include "chrome/common/ipc_message_utils.h"
+// Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
+// which has too many data parameters to be reasonably put in a predefined
+// IPC message. The data members directly correspond to parameters of
+// WebWorkerClient::postConsoleMessageToWorkerObject()
+struct WorkerHostMsg_PostConsoleMessageToWorkerObject_Params {
+ int destination_identifier;
+ int source_identifier;
+ int message_type;
+ int message_level;
+ string16 message;
+ int line_number;
+ string16 source_url;
+};
+
+namespace IPC {
+
+// Traits for WorkerHostMsg_PostConsoleMessageToWorkerObject_Params structure
+// to pack/unpack.
+template <>
+struct ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params> {
+ typedef WorkerHostMsg_PostConsoleMessageToWorkerObject_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.destination_identifier);
+ WriteParam(m, p.source_identifier);
+ WriteParam(m, p.message_type);
+ WriteParam(m, p.message_level);
+ WriteParam(m, p.message);
+ WriteParam(m, p.line_number);
+ WriteParam(m, p.source_url);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->destination_identifier) &&
+ ReadParam(m, iter, &p->source_identifier) &&
+ ReadParam(m, iter, &p->message_type) &&
+ ReadParam(m, iter, &p->message_level) &&
+ ReadParam(m, iter, &p->message) &&
+ ReadParam(m, iter, &p->line_number) &&
+ ReadParam(m, iter, &p->source_url);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.destination_identifier, l);
+ l->append(L", ");
+ LogParam(p.source_identifier, l);
+ l->append(L", ");
+ LogParam(p.message_type, l);
+ l->append(L", ");
+ LogParam(p.message_level, l);
+ l->append(L", ");
+ LogParam(p.message, l);
+ l->append(L", ");
+ LogParam(p.line_number, l);
+ l->append(L", ");
+ LogParam(p.source_url, l);
+ l->append(L")");
+ }
+};
+
+} // namespace IPC
#define MESSAGES_INTERNAL_FILE "chrome/common/worker_messages_internal.h"
#include "chrome/common/ipc_message_macros.h"
diff --git a/chrome/common/worker_messages_internal.h b/chrome/common/worker_messages_internal.h
index 41707fd..74063c1 100644
--- a/chrome/common/worker_messages_internal.h
+++ b/chrome/common/worker_messages_internal.h
@@ -55,14 +55,8 @@ IPC_BEGIN_MESSAGES(WorkerHost)
int /* line_number */,
string16 /* source_url*/)
- IPC_MESSAGE_ROUTED7(WorkerHostMsg_PostConsoleMessageToWorkerObject,
- int /* destination */,
- int /* source */,
- int /* type */,
- int /* level */,
- string16 /* message */,
- int /* line_number */,
- string16 /* source_url */)
+ IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject,
+ WorkerHostMsg_PostConsoleMessageToWorkerObject_Params)
IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject,
bool /* bool has_pending_activity */)