diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 09:13:01 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 09:13:01 +0000 |
commit | 503683f23ea6fe3eb728f2d09f81f2603ffc7d6f (patch) | |
tree | f9bb89d453f8d1dbd4689f0d14c477ca10e2356f /chrome/common/ipc_message_utils.h | |
parent | c8c4f954af8b55d12a3d76a0ef41def31594aceb (diff) | |
download | chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.zip chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.tar.gz chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.tar.bz2 |
Developer tools messages are forwarded as wrapped IPC::Messages(previously they were represented as int type+string body).
I stole IPC::Message serialization code from jam's CL(http://codereview.chromium.org/20413).
jam: please look at message forwarding code. When tools messages are send from browser to renderer they are also wrapped(unlike worker messages which are unwrapped and sent as is). It allows to describe developer tools messages in its own file instead of putting all of them into render_messages_internal.h
brettw: please check if it's OK to have ForwardMessageToToolsClient in WebContentsView
Review URL: http://codereview.chromium.org/21540
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_message_utils.h')
-rw-r--r-- | chrome/common/ipc_message_utils.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h index 428c889..8f813f6 100644 --- a/chrome/common/ipc_message_utils.h +++ b/chrome/common/ipc_message_utils.h @@ -54,6 +54,8 @@ enum IPCMessageStart { PluginHostMsgStart, NPObjectMsgStart, TestMsgStart, + DevToolsAgentMsgStart, + DevToolsClientMsgStart, // 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 @@ -892,6 +894,27 @@ struct ParamTraits<LogData> { }; template <> +struct ParamTraits<Message> { + static void Write(Message* m, const Message& p) { + m->WriteInt(p.size()); + m->WriteData(reinterpret_cast<const char*>(p.data()), p.size()); + } + static bool Read(const Message* m, void** iter, Message* r) { + int size; + if (!m->ReadInt(iter, &size)) + return false; + const char* data; + if (!m->ReadData(iter, &data, &size)) + return false; + *r = Message(data, size); + return true; + } + static void Log(const Message& p, std::wstring* l) { + l->append(L"<IPC::Message>"); + } +}; + +template <> struct ParamTraits<Tuple0> { typedef Tuple0 param_type; static void Write(Message* m, const param_type& p) { |