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

Side by Side Diff: chrome/common/ipc_message_macros.h

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/ipc_channel_win.cc ('k') | chrome/common/ipc_sync_channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This header is meant to be included in multiple passes, hence no traditional 5 // This header is meant to be included in multiple passes, hence no traditional
6 // header guard. 6 // header guard.
7 // 7 //
8 // In the first pass, IPC_MESSAGE_MACROS_ENUMS should be defined, which will 8 // In the first pass, IPC_MESSAGE_MACROS_ENUMS should be defined, which will
9 // create enums for each of the messages defined with the IPC_MESSAGE_* macros. 9 // create enums for each of the messages defined with the IPC_MESSAGE_* macros.
10 // 10 //
11 // In the second pass, either IPC_MESSAGE_MACROS_DEBUGSTRINGS or 11 // In the second pass, either IPC_MESSAGE_MACROS_DEBUGSTRINGS or
12 // IPC_MESSAGE_MACROS_CLASSES should be defined (if both, DEBUGSTRINGS takes 12 // IPC_MESSAGE_MACROS_CLASSES should be defined (if both, DEBUGSTRINGS takes
13 // precedence). Only one .cc file should have DEBUGSTRINGS defined, as this 13 // precedence). Only one .cc file should have DEBUGSTRINGS defined, as this
14 // will create helper functions mapping message types to strings. Having 14 // will create helper functions mapping message types to strings. Having
15 // CLASSES defined will create classes for each of the messages defined with 15 // CLASSES defined will create classes for each of the messages defined with
16 // the IPC_MESSAGE_* macros. 16 // the IPC_MESSAGE_* macros.
17 // 17 //
18 // "Sync" messages are just synchronous calls, the Send() call doesn't return 18 // "Sync" messages are just synchronous calls, the Send() call doesn't return
19 // until a reply comes back. Input parameters are first (const TYPE&), and 19 // until a reply comes back. Input parameters are first (const TYPE&), and
20 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the 20 // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the
21 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 out) . 21 // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2
22 // The caller does a Send([route id, ], in1, &out1, &out2). 22 // out). The caller does a Send([route id, ], in1, &out1, &out2).
23 // The receiver's handler function will be 23 // The receiver's handler function will be
24 // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2) 24 // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2)
25 // 25 //
26 // 26 //
27 // A caller can also send a synchronous message, while the receiver can respond 27 // A caller can also send a synchronous message, while the receiver can respond
28 // at a later time. This is transparent from the sender's size. The receiver 28 // at a later time. This is transparent from the sender's size. The receiver
29 // needs to use a different handler that takes in a IPC::Message* as the output 29 // needs to use a different handler that takes in a IPC::Message* as the output
30 // type, stash the message, and when it has the data it can Send the message. 30 // type, stash the message, and when it has the data it can Send the message.
31 // 31 //
32 // Use the IPC_MESSAGE_HANDLER_DELAY_REPLY macro instead of IPC_MESSAGE_HANDLER 32 // Use the IPC_MESSAGE_HANDLER_DELAY_REPLY macro instead of IPC_MESSAGE_HANDLER
33 // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName, OnSyncMessag eName) 33 // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName,
34 // OnSyncMessageName)
34 // 35 //
35 // The handler function will look like: 36 // The handler function will look like:
36 // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg); 37 // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg);
37 // 38 //
38 // Receiver stashes the IPC::Message* pointer, and when it's ready, it does: 39 // Receiver stashes the IPC::Message* pointer, and when it's ready, it does:
39 // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2); 40 // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2);
40 // Send(reply_msg); 41 // Send(reply_msg);
41 42
42 #include "chrome/common/ipc_message_utils.h" 43 #include "chrome/common/ipc_message_utils.h"
43 44
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #undef IPC_SYNC_MESSAGE_ROUTED4_2 134 #undef IPC_SYNC_MESSAGE_ROUTED4_2
134 135
135 #if defined(IPC_MESSAGE_MACROS_ENUMS) 136 #if defined(IPC_MESSAGE_MACROS_ENUMS)
136 #undef IPC_MESSAGE_MACROS_ENUMS 137 #undef IPC_MESSAGE_MACROS_ENUMS
137 138
138 // TODO(jabdelmalek): we're using the lowest 12 bits of type for the message 139 // TODO(jabdelmalek): we're using the lowest 12 bits of type for the message
139 // id, and the highest 4 bits for the channel type. This constrains us to 140 // id, and the highest 4 bits for the channel type. This constrains us to
140 // 16 channel types (currently using 8) and 4K messages per type. Should 141 // 16 channel types (currently using 8) and 4K messages per type. Should
141 // really make type be 32 bits, but then we break automation with older Chrome 142 // really make type be 32 bits, but then we break automation with older Chrome
142 // builds.. 143 // builds..
143 144 // Do label##PreStart so that automation messages keep the same id as before.
144 #define IPC_BEGIN_MESSAGES(label) \ 145 #define IPC_BEGIN_MESSAGES(label) \
145 enum label##MsgType { \ 146 enum label##MsgType { \
146 label##Start = label##MsgStart << 12, \ 147 label##Start = label##MsgStart << 12, \
147 label##PreStart = (label##MsgStart << 12) - 1, // Do this so that automation messages keep the same id as before 148 label##PreStart = (label##MsgStart << 12) - 1,
148 149
149 #define IPC_END_MESSAGES(label) \ 150 #define IPC_END_MESSAGES(label) \
150 label##End \ 151 label##End \
151 }; 152 };
152 153
153 #define IPC_MESSAGE_CONTROL0(msg_class) \ 154 #define IPC_MESSAGE_CONTROL0(msg_class) \
154 msg_class##__ID, 155 msg_class##__ID,
155 156
156 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ 157 #define IPC_MESSAGE_CONTROL1(msg_class, type1) \
157 msg_class##__ID, 158 msg_class##__ID,
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 public: \ 1143 public: \
1143 enum { ID = msg_class##__ID }; \ 1144 enum { ID = msg_class##__ID }; \
1144 msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6) \ 1145 msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6) \
1145 : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ 1146 : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \
1146 Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ 1147 Tuple2<type1_out&, type2_out&> >(routing_id, ID, \
1147 MakeTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \ 1148 MakeTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \
1148 }; 1149 };
1149 1150
1150 #endif // #if defined() 1151 #endif // #if defined()
1151 1152
OLDNEW
« no previous file with comments | « chrome/common/ipc_channel_win.cc ('k') | chrome/common/ipc_sync_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698