summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_message_macros.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 19:14:33 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 19:14:33 +0000
commit08658a41d004daaf4183537fe2314eb2532881ee (patch)
tree118bbbd7944c714098d1aa289ed1dd4cb7d5d42b /chrome/common/ipc_message_macros.h
parent0a14d3db1762fb2e309e5f0e07279f91ed2bb128 (diff)
downloadchromium_src-08658a41d004daaf4183537fe2314eb2532881ee.zip
chromium_src-08658a41d004daaf4183537fe2314eb2532881ee.tar.gz
chromium_src-08658a41d004daaf4183537fe2314eb2532881ee.tar.bz2
Fix ipc logging for non browser processes. I broke this in my last refactoring, since the logger functions only got registered in the browser. This fix registers them using a global object for each message type (that's only compiled when debugging is enabled). One less thing to take care of when creating new message types.
Review URL: http://codereview.chromium.org/20213 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_message_macros.h')
-rw-r--r--chrome/common/ipc_message_macros.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h
index fe39efa..59d5d35 100644
--- a/chrome/common/ipc_message_macros.h
+++ b/chrome/common/ipc_message_macros.h
@@ -365,6 +365,17 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#elif defined(IPC_MESSAGE_MACROS_LOG)
#undef IPC_MESSAGE_MACROS_LOG
+#ifndef IPC_LOG_TABLE_CREATED
+#define IPC_LOG_TABLE_CREATED
+typedef void (LogFunction)(uint16 type,
+ std::wstring* name,
+ const IPC::Message* msg,
+ std::wstring* params);
+
+LogFunction* g_log_function_mapping[LastMsgIndex];
+#endif
+
+
#define IPC_BEGIN_MESSAGES(label) \
void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
switch (type) {
@@ -374,7 +385,14 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
if (name) \
*name = L"[UNKNOWN " L ## #label L" MSG"; \
} \
- }
+ } \
+ class LoggerRegisterHelper##label { \
+ public: \
+ LoggerRegisterHelper##label() { \
+ g_log_function_mapping[label##MsgStart] = label##MsgLog; \
+ } \
+ }; \
+ LoggerRegisterHelper##label g_LoggerRegisterHelper##label;
#define IPC_MESSAGE_LOG(msg_class) \
case msg_class##__ID: \