From f91cb991c81afccc52824d369973098398c5ce31 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Wed, 4 Feb 2009 20:10:12 +0000 Subject: Commit just the changes to make creating new IPC channel types easier. TBR=mpcomplete Review URL: http://codereview.chromium.org/21052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9167 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/ipc_message_utils.h | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'chrome/common/ipc_message_utils.h') diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h index 39bb231..d76e695 100644 --- a/chrome/common/ipc_message_utils.h +++ b/chrome/common/ipc_message_utils.h @@ -34,16 +34,32 @@ namespace webkit_glue { struct WebApplicationInfo; } // namespace webkit_glue -namespace IPC { +// Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique +// base. Messages have unique IDs across channels in order for the IPC logging +// code to figure out the message class from its ID. +enum IPCMessageStart { + // By using a start value of 0 for automation messages, we keep backward + // compatibility with old builds. + AutomationMsgStart = 0, + ViewMsgStart, + ViewHostMsgStart, + PluginProcessMsgStart, + PluginProcessHostMsgStart, + PluginMsgStart, + PluginHostMsgStart, + NPObjectMsgStart, + TestMsgStart, + // NOTE: When you add a new message class, also update + // IPCStatusView::IPCStatusView to ensure logging works. + // NOTE: this enum is used by IPC_MESSAGE_MACRO to generate a unique message + // id. Only 4 bits are used for the message type, so if this enum needs more + // than 16 entries, that code needs to be updated. + LastMsgIndex +}; -// Used by the message macros to register a logging function based on the -// message class. -typedef void (LogFunction)(uint16 type, - std::wstring* name, - const IPC::Message* msg, - std::wstring* params); -void RegisterMessageLogger(int msg_start, LogFunction* func); +COMPILE_ASSERT(LastMsgIndex <= 16, need_to_update_IPC_MESSAGE_MACRO); +namespace IPC { //----------------------------------------------------------------------------- // An iterator class for reading the fields contained within a Message. -- cgit v1.1