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

Side by Side Diff: ipc/ipc_message_macros.h

Issue 9425006: Make IPC_MESSAGE_EXPORT more robust. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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 | « ipc/ipc_message.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Defining IPC Messages 5 // Defining IPC Messages
6 // 6 //
7 // Your IPC messages will be defined by macros inside of an XXX_messages.h 7 // Your IPC messages will be defined by macros inside of an XXX_messages.h
8 // header file. Most of the time, the system can automatically generate all 8 // header file. Most of the time, the system can automatically generate all
9 // of messaging mechanism from these definitions, but sometimes some manual 9 // of messaging mechanism from these definitions, but sometimes some manual
10 // coding is required. In these cases, you will also have an XXX_messages.cc 10 // coding is required. In these cases, you will also have an XXX_messages.cc
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName, 166 // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName,
167 // OnSyncMessageName) 167 // OnSyncMessageName)
168 // 168 //
169 // The handler function will look like: 169 // The handler function will look like:
170 // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg); 170 // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg);
171 // 171 //
172 // Receiver stashes the IPC::Message* pointer, and when it's ready, it does: 172 // Receiver stashes the IPC::Message* pointer, and when it's ready, it does:
173 // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2); 173 // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2);
174 // Send(reply_msg); 174 // Send(reply_msg);
175 175
176 // Files that want to export their ipc messages should do
177 // #undef IPC_MESSAGE_EXPORT
178 // #define IPC_MESSAGE_EXPORT VISIBILITY_MACRO
179 // after including this header, but before using any of the macros below.
180 // (This needs to be before the include guard.)
181 #undef IPC_MESSAGE_EXPORT
182 #define IPC_MESSAGE_EXPORT
183
176 #ifndef IPC_IPC_MESSAGE_MACROS_H_ 184 #ifndef IPC_IPC_MESSAGE_MACROS_H_
177 #define IPC_IPC_MESSAGE_MACROS_H_ 185 #define IPC_IPC_MESSAGE_MACROS_H_
178 186
179 #include "base/profiler/scoped_profile.h" 187 #include "base/profiler/scoped_profile.h"
180 #include "ipc/ipc_message_utils.h" 188 #include "ipc/ipc_message_utils.h"
181 #include "ipc/param_traits_macros.h" 189 #include "ipc/param_traits_macros.h"
182 190
183 #if defined(IPC_MESSAGE_IMPL) 191 #if defined(IPC_MESSAGE_IMPL)
184 #include "ipc/ipc_message_utils_impl.h" 192 #include "ipc/ipc_message_utils_impl.h"
185 #endif 193 #endif
186 194
187 // Override this to force message classes to be exported.
188 #ifndef IPC_MESSAGE_EXPORT
189 #define IPC_MESSAGE_EXPORT
190 #endif
191
192 // Macros for defining structs. May be subsequently redefined. 195 // Macros for defining structs. May be subsequently redefined.
193 #define IPC_STRUCT_BEGIN(struct_name) \ 196 #define IPC_STRUCT_BEGIN(struct_name) \
194 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams) 197 IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, IPC::NoParams)
195 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \ 198 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
196 struct struct_name; \ 199 struct struct_name; \
197 IPC_STRUCT_TRAITS_BEGIN(struct_name) \ 200 IPC_STRUCT_TRAITS_BEGIN(struct_name) \
198 IPC_STRUCT_TRAITS_END() \ 201 IPC_STRUCT_TRAITS_END() \
199 struct IPC_MESSAGE_EXPORT struct_name : parent { \ 202 struct IPC_MESSAGE_EXPORT struct_name : parent { \
200 struct_name(); \ 203 struct_name(); \
201 ~struct_name(); 204 ~struct_name();
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 // This corresponds to an enum value from IPCMessageStart. 1008 // This corresponds to an enum value from IPCMessageStart.
1006 #define IPC_MESSAGE_CLASS(message) \ 1009 #define IPC_MESSAGE_CLASS(message) \
1007 IPC_MESSAGE_ID_CLASS(message.type()) 1010 IPC_MESSAGE_ID_CLASS(message.type())
1008 1011
1009 #endif // IPC_IPC_MESSAGE_MACROS_H_ 1012 #endif // IPC_IPC_MESSAGE_MACROS_H_
1010 1013
1011 // Clean up IPC_MESSAGE_START in this unguarded section so that the 1014 // Clean up IPC_MESSAGE_START in this unguarded section so that the
1012 // XXX_messages.h files need not do so themselves. This makes the 1015 // XXX_messages.h files need not do so themselves. This makes the
1013 // XXX_messages.h files easier to write. 1016 // XXX_messages.h files easier to write.
1014 #undef IPC_MESSAGE_START 1017 #undef IPC_MESSAGE_START
OLDNEW
« no previous file with comments | « ipc/ipc_message.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698