OLD | NEW |
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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, this, \ | 947 msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, this, \ |
948 &member_func); \ | 948 &member_func); \ |
949 } \ | 949 } \ |
950 break; | 950 break; |
951 | 951 |
952 #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ | 952 #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ |
953 IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) | 953 IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) |
954 | 954 |
955 #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ | 955 #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ |
956 case msg_class::ID: { \ | 956 case msg_class::ID: { \ |
957 /* TRACK_RUN_IN_IPC_HANDLER(member_func); TODO(jar) */ \ | 957 TRACK_RUN_IN_IPC_HANDLER(member_func); \ |
958 msg_is_ok__ = msg_class::DispatchDelayReply(&ipc_message__, obj, \ | 958 msg_is_ok__ = msg_class::DispatchDelayReply(&ipc_message__, obj, \ |
959 &member_func); \ | 959 &member_func); \ |
960 } \ | 960 } \ |
961 break; | 961 break; |
962 | 962 |
963 #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ | 963 #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ |
964 IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ | 964 IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ |
965 _IpcMessageHandlerClass::member_func) | 965 _IpcMessageHandlerClass::member_func) |
966 | 966 |
| 967 // TODO(jar): fix chrome frame to always supply |code| argument. |
967 #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ | 968 #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ |
968 case msg_class::ID: { \ | 969 case msg_class::ID: { \ |
969 /* TRACK_RUN_IN_IPC_HANDLER(code); TODO(jar) */ \ | 970 /* TRACK_RUN_IN_IPC_HANDLER(code); TODO(jar) */ \ |
970 code; \ | 971 code; \ |
971 } \ | 972 } \ |
972 break; | 973 break; |
973 | 974 |
974 #define IPC_REPLY_HANDLER(func) \ | 975 #define IPC_REPLY_HANDLER(func) \ |
975 case IPC_REPLY_ID: { \ | 976 case IPC_REPLY_ID: { \ |
976 TRACK_RUN_IN_IPC_HANDLER(func); \ | 977 TRACK_RUN_IN_IPC_HANDLER(func); \ |
977 func(ipc_message__); \ | 978 func(ipc_message__); \ |
978 } \ | 979 } \ |
979 break; | 980 break; |
980 | 981 |
981 | 982 |
982 #define IPC_MESSAGE_UNHANDLED(code) \ | 983 #define IPC_MESSAGE_UNHANDLED(code) \ |
983 default: { \ | 984 default: { \ |
984 /* TRACK_RUN_IN_IPC_HANDLER(code); TODO(jar) */ \ | |
985 code; \ | 985 code; \ |
986 } \ | 986 } \ |
987 break; | 987 break; |
988 | 988 |
989 #define IPC_MESSAGE_UNHANDLED_ERROR() \ | 989 #define IPC_MESSAGE_UNHANDLED_ERROR() \ |
990 IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ | 990 IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ |
991 "Invalid message with type = " << \ | 991 "Invalid message with type = " << \ |
992 ipc_message__.type()) | 992 ipc_message__.type()) |
993 | 993 |
994 #define IPC_END_MESSAGE_MAP() \ | 994 #define IPC_END_MESSAGE_MAP() \ |
995 DCHECK(msg_is_ok__); \ | 995 DCHECK(msg_is_ok__); \ |
996 } \ | 996 } \ |
997 } | 997 } |
998 | 998 |
999 #define IPC_END_MESSAGE_MAP_EX() \ | 999 #define IPC_END_MESSAGE_MAP_EX() \ |
1000 } \ | 1000 } \ |
1001 } | 1001 } |
1002 | 1002 |
1003 // This corresponds to an enum value from IPCMessageStart. | 1003 // This corresponds to an enum value from IPCMessageStart. |
1004 #define IPC_MESSAGE_CLASS(message) \ | 1004 #define IPC_MESSAGE_CLASS(message) \ |
1005 IPC_MESSAGE_ID_CLASS(message.type()) | 1005 IPC_MESSAGE_ID_CLASS(message.type()) |
1006 | 1006 |
1007 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 1007 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
1008 | 1008 |
1009 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 1009 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
1010 // XXX_messages.h files need not do so themselves. This makes the | 1010 // XXX_messages.h files need not do so themselves. This makes the |
1011 // XXX_messages.h files easier to write. | 1011 // XXX_messages.h files easier to write. |
1012 #undef IPC_MESSAGE_START | 1012 #undef IPC_MESSAGE_START |
OLD | NEW |