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

Unified Diff: chrome/common/ipc_message_macros.h

Issue 20015: Make it easier to create new IPC channel types (i.e. renderer/plugin). Inste... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/common/ipc_logging.cc ('k') | chrome/common/ipc_message_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_message_macros.h
===================================================================
--- chrome/common/ipc_message_macros.h (revision 9103)
+++ chrome/common/ipc_message_macros.h (working copy)
@@ -41,6 +41,33 @@
#include "chrome/common/ipc_message_utils.h"
+
+#ifndef MESSAGES_INTERNAL_FILE
+#error This file should only be included by X_messages.h, which needs to define MESSAGES_INTERNAL_FILE first.
+#endif
+
+#ifndef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+#define IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+
+// Multi-pass include of X_messages_internal.h. Preprocessor magic allows
+// us to use 1 header to define the enums and classes for our render messages.
+#define IPC_MESSAGE_MACROS_ENUMS
+#include MESSAGES_INTERNAL_FILE
+
+#define IPC_MESSAGE_MACROS_CLASSES
+#include MESSAGES_INTERNAL_FILE
+
+#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
+#define IPC_MESSAGE_MACROS_LOG
+#include MESSAGES_INTERNAL_FILE
+#endif
+
+#undef MESSAGES_INTERNAL_FILE
+#undef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+
+#endif
+
+
// Undefine the macros from the previous pass (if any).
#undef IPC_BEGIN_MESSAGES
#undef IPC_END_MESSAGES
@@ -57,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
@@ -94,6 +120,7 @@
#undef IPC_SYNC_MESSAGE_ROUTED4_0
#undef IPC_SYNC_MESSAGE_ROUTED4_1
+
#if defined(IPC_MESSAGE_MACROS_ENUMS)
#undef IPC_MESSAGE_MACROS_ENUMS
@@ -102,10 +129,11 @@
// 16 channel types (currently using 8) and 4K messages per type. Should
// really make type be 32 bits, but then we break automation with older Chrome
// builds..
-#define IPC_BEGIN_MESSAGES(label, start) \
+
+#define IPC_BEGIN_MESSAGES(label) \
enum label##MsgType { \
- label##Start = start << 12, \
- label##PreStart = (start << 12) - 1, // Do this so that automation messages keep the same id as before
+ label##Start = label##MsgStart << 12, \
+ label##PreStart = (label##MsgStart << 12) - 1, // Do this so that automation messages keep the same id as before
#define IPC_END_MESSAGES(label) \
label##End \
@@ -150,9 +178,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,
@@ -341,7 +366,7 @@
#elif defined(IPC_MESSAGE_MACROS_LOG)
#undef IPC_MESSAGE_MACROS_LOG
-#define IPC_BEGIN_MESSAGES(label, start) \
+#define IPC_BEGIN_MESSAGES(label) \
void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
switch (type) {
@@ -399,9 +424,6 @@
#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)
@@ -510,7 +532,7 @@
#elif defined(IPC_MESSAGE_MACROS_CLASSES)
#undef IPC_MESSAGE_MACROS_CLASSES
-#define IPC_BEGIN_MESSAGES(label, start)
+#define IPC_BEGIN_MESSAGES(label)
#define IPC_END_MESSAGES(label)
#define IPC_MESSAGE_CONTROL0(msg_class) \
@@ -655,14 +677,6 @@
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: \
« no previous file with comments | « chrome/common/ipc_logging.cc ('k') | chrome/common/ipc_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698