OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 // } | 890 // } |
891 | 891 |
892 | 892 |
893 #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ | 893 #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ |
894 { \ | 894 { \ |
895 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ | 895 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ |
896 void* param__ = NULL; \ | 896 void* param__ = NULL; \ |
897 const IPC::Message& ipc_message__ = msg; \ | 897 const IPC::Message& ipc_message__ = msg; \ |
898 switch (ipc_message__.type()) { | 898 switch (ipc_message__.type()) { |
899 | 899 |
900 // gcc gives the following error now when using decltype so type typeof there: | |
901 // error: identifier 'decltype' will become a keyword in C++0x [-Werror=c++0x-
compat] | |
902 #if defined(OS_WIN) | |
903 #define IPC_DECLTYPE decltype | |
904 #else | |
905 #define IPC_DECLTYPE typeof | |
906 #endif | |
907 | |
908 #define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ | 900 #define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ |
909 { \ | 901 { \ |
910 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ | 902 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ |
911 IPC_DECLTYPE(param) param__ = param; \ | 903 decltype(param) param__ = param; \ |
912 const IPC::Message& ipc_message__ = msg; \ | 904 const IPC::Message& ipc_message__ = msg; \ |
913 switch (ipc_message__.type()) { | 905 switch (ipc_message__.type()) { |
914 | 906 |
915 #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ | 907 #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ |
916 case msg_class::ID: { \ | 908 case msg_class::ID: { \ |
917 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ | 909 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
918 if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ | 910 if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ |
919 &member_func)) \ | 911 &member_func)) \ |
920 ipc_message__.set_dispatch_error(); \ | 912 ipc_message__.set_dispatch_error(); \ |
921 } \ | 913 } \ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 // equivalent without the #ifdef, VS2013 contains a bug where it is | 970 // equivalent without the #ifdef, VS2013 contains a bug where it is |
979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 971 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 972 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
981 // This can be removed once VS2013 is fixed. | 973 // This can be removed once VS2013 is fixed. |
982 #ifdef IPC_MESSAGE_START | 974 #ifdef IPC_MESSAGE_START |
983 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 975 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
984 // XXX_messages.h files need not do so themselves. This makes the | 976 // XXX_messages.h files need not do so themselves. This makes the |
985 // XXX_messages.h files easier to write. | 977 // XXX_messages.h files easier to write. |
986 #undef IPC_MESSAGE_START | 978 #undef IPC_MESSAGE_START |
987 #endif | 979 #endif |
OLD | NEW |