Index: ipc/ipc_message_macros.h |
=================================================================== |
--- ipc/ipc_message_macros.h (revision 74010) |
+++ ipc/ipc_message_macros.h (working copy) |
@@ -1,11 +1,8 @@ |
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2006-2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// This header is meant to be included in multiple passes, hence no traditional |
-// header guard. |
-// |
-// In your XXX_messages_internal.h file, before defining any messages do: |
+// In your XXX_messages.h file, before defining any messages do: |
// #define IPC_MESSAGE_START XMsgStart |
// XMstStart value is from the IPCMessageStart enum in ipc_message_utils.h, and |
// needs to be unique for each different file. |
@@ -38,12 +35,13 @@ |
// ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2); |
// Send(reply_msg); |
+#ifndef IPC_IPC_MESSAGE_MACROS_H_ |
+#define IPC_IPC_MESSAGE_MACROS_H_ |
+// Can use #pragma once all XXX_messages.h files clean up IPC_MESSAGE_START |
+ |
#include "ipc/ipc_message_utils.h" |
+#include "ipc/ipc_param_traits_macros.h" |
-// In case a file includes several X_messages.h files, we don't want to get |
-// errors because each X_messages_internal.h file will define this. |
-#undef IPC_MESSAGE_START |
- |
#if defined(IPC_MESSAGE_IMPL) |
#include "ipc/ipc_message_impl_macros.h" |
#elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED) |
@@ -60,7 +58,7 @@ |
typedef base::hash_map<uint32, LogFunction > LogFunctionMap; |
LogFunctionMap g_log_function_mapping; |
-#endif |
+#endif // IPC_LOG_TABLE_CREATED |
#define IPC_MESSAGE_LOG(msg_class) \ |
@@ -280,7 +278,7 @@ |
#define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \ |
IPC_MESSAGE_LOG(msg_class) |
-#else |
+#else // defined(IPC_MESSAGE_MACROS_LOG_ENABLED) |
#define IPC_MESSAGE_CONTROL0_EXTRA(msg_class) |
#define IPC_MESSAGE_CONTROL1_EXTRA(msg_class, type1) |
@@ -352,8 +350,30 @@ |
#define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) |
#define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type4_out) |
-#endif |
+#endif // defined(IPC_MESSAGE_MACROS_LOG_ENABLED) |
+// Force IPC message guard convention single-include semantics. |
+#define IPC_MESSAGE_REINCLUDE 0 |
+ |
+// Macros for defining structures. May be subsequently redefined. |
+#define IPC_STRUCT_BEGIN(struct_name) \ |
+ struct struct_name : IPC::NoParams { \ |
+ struct_name(); \ |
+ ~struct_name(); |
+#define IPC_STRUCT_MEMBER(type, name) type name; |
+#define IPC_STRUCT_END(struct_name) \ |
+ }; \ |
+ IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |
+ IPC_STRUCT_TRAITS_END(struct_name) |
+ |
+// Macros for defining enums. May be subsequently redefined. |
+#define IPC_ENUM_BEGIN(enum_name) enum enum_name { |
+#define IPC_ENUM_VALUE(name) name, |
+#define IPC_ENUM_END(enum_name) \ |
+ }; \ |
+ IPC_ENUM_TRAITS_BEGIN(enum_name) \ |
+ IPC_ENUM_TRAITS_END(enum_name) |
+ |
// Note: we currently use __LINE__ to give unique IDs to messages within a file. |
// They're globally unique since each file defines its own IPC_MESSAGE_START. |
// Ideally, we wouldn't use line numbers, but instead use the __COUNTER__ macro, |
@@ -1243,3 +1263,9 @@ |
// This corresponds to an enum value from IPCMessageStart. |
#define IPC_MESSAGE_CLASS(message) \ |
message.type() >> 16 |
+ |
+#endif // IPC_IPC_MESSAGE_MACROS_H_ |
+ |
+ |
+// Clean up IPC_MESSAGE_START in this unguarded section. |
+#undef IPC_MESSAGE_START |