| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 // ...more handlers here ... | 885 // ...more handlers here ... |
| 886 // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) | 886 // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) |
| 887 // IPC_MESSAGE_UNHANDLED(handled = false) | 887 // IPC_MESSAGE_UNHANDLED(handled = false) |
| 888 // IPC_END_MESSAGE_MAP() | 888 // IPC_END_MESSAGE_MAP() |
| 889 // return handled; | 889 // return handled; |
| 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; \ | 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: | 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] | 901 // error: identifier 'decltype' will become a keyword in C++0x [-Werror=c++0x-
compat] |
| 902 #if defined(OS_WIN) | 902 #if defined(OS_WIN) |
| 903 #define IPC_DECLTYPE decltype | 903 #define IPC_DECLTYPE decltype |
| 904 #else | 904 #else |
| 905 #define IPC_DECLTYPE typeof | 905 #define IPC_DECLTYPE typeof |
| 906 #endif | 906 #endif |
| 907 | 907 |
| 908 #define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ | 908 #define IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(class_name, msg, param) \ |
| 909 { \ | 909 { \ |
| 910 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED; \ | 910 typedef class_name _IpcMessageHandlerClass ALLOW_UNUSED_TYPE; \ |
| 911 IPC_DECLTYPE(param) param__ = param; \ | 911 IPC_DECLTYPE(param) param__ = param; \ |
| 912 const IPC::Message& ipc_message__ = msg; \ | 912 const IPC::Message& ipc_message__ = msg; \ |
| 913 switch (ipc_message__.type()) { | 913 switch (ipc_message__.type()) { |
| 914 | 914 |
| 915 #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ | 915 #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ |
| 916 case msg_class::ID: { \ | 916 case msg_class::ID: { \ |
| 917 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ | 917 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
| 918 if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ | 918 if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \ |
| 919 &member_func)) \ | 919 &member_func)) \ |
| 920 ipc_message__.set_dispatch_error(); \ | 920 ipc_message__.set_dispatch_error(); \ |
| 921 } \ | 921 } \ |
| 922 break; | 922 break; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 // equivalent without the #ifdef, VS2013 contains a bug where it is | 978 // equivalent without the #ifdef, VS2013 contains a bug where it is |
| 979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
| 980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
| 981 // This can be removed once VS2013 is fixed. | 981 // This can be removed once VS2013 is fixed. |
| 982 #ifdef IPC_MESSAGE_START | 982 #ifdef IPC_MESSAGE_START |
| 983 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 983 // 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 | 984 // XXX_messages.h files need not do so themselves. This makes the |
| 985 // XXX_messages.h files easier to write. | 985 // XXX_messages.h files easier to write. |
| 986 #undef IPC_MESSAGE_START | 986 #undef IPC_MESSAGE_START |
| 987 #endif | 987 #endif |
| OLD | NEW |