| 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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; \ |
| 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_IPC_HANDLER(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; |
| 923 | 923 |
| 924 #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ | 924 #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ |
| 925 IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) | 925 IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) |
| 926 | 926 |
| 927 #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ | 927 #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ |
| 928 case msg_class::ID: { \ | 928 case msg_class::ID: { \ |
| 929 TRACK_RUN_IN_IPC_HANDLER(member_func); \ | 929 TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \ |
| 930 if (!msg_class::DispatchDelayReply(&ipc_message__, obj, param__, \ | 930 if (!msg_class::DispatchDelayReply(&ipc_message__, obj, param__, \ |
| 931 &member_func)) \ | 931 &member_func)) \ |
| 932 ipc_message__.set_dispatch_error(); \ | 932 ipc_message__.set_dispatch_error(); \ |
| 933 } \ | 933 } \ |
| 934 break; | 934 break; |
| 935 | 935 |
| 936 #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ | 936 #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ |
| 937 IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ | 937 IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, \ |
| 938 _IpcMessageHandlerClass::member_func) | 938 _IpcMessageHandlerClass::member_func) |
| 939 | 939 |
| 940 // TODO(jar): fix chrome frame to always supply |code| argument. | 940 // TODO(jar): fix chrome frame to always supply |code| argument. |
| 941 #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ | 941 #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ |
| 942 case msg_class::ID: { \ | 942 case msg_class::ID: { \ |
| 943 /* TRACK_RUN_IN_IPC_HANDLER(code); TODO(jar) */ \ | 943 /* TRACK_RUN_IN_THIS_SCOPED_REGION(code); TODO(jar) */ \ |
| 944 code; \ | 944 code; \ |
| 945 } \ | 945 } \ |
| 946 break; | 946 break; |
| 947 | 947 |
| 948 #define IPC_REPLY_HANDLER(func) \ | 948 #define IPC_REPLY_HANDLER(func) \ |
| 949 case IPC_REPLY_ID: { \ | 949 case IPC_REPLY_ID: { \ |
| 950 TRACK_RUN_IN_IPC_HANDLER(func); \ | 950 TRACK_RUN_IN_THIS_SCOPED_REGION(func); \ |
| 951 func(ipc_message__); \ | 951 func(ipc_message__); \ |
| 952 } \ | 952 } \ |
| 953 break; | 953 break; |
| 954 | 954 |
| 955 | 955 |
| 956 #define IPC_MESSAGE_UNHANDLED(code) \ | 956 #define IPC_MESSAGE_UNHANDLED(code) \ |
| 957 default: { \ | 957 default: { \ |
| 958 code; \ | 958 code; \ |
| 959 } \ | 959 } \ |
| 960 break; | 960 break; |
| (...skipping 17 matching lines...) Expand all 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 |