diff options
Diffstat (limited to 'ppapi/host')
-rw-r--r-- | ppapi/host/dispatch_host_message.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/ppapi/host/dispatch_host_message.h b/ppapi/host/dispatch_host_message.h index 070b746..9a3fae5 100644 --- a/ppapi/host/dispatch_host_message.h +++ b/ppapi/host/dispatch_host_message.h @@ -61,20 +61,28 @@ inline int32_t DispatchResourceCall(ObjT* obj, Method method, return (obj->*method)(context, arg.a, arg.b, arg.c, arg.d, arg.e); } +// Note that this only works for message with 1 or more parameters. For +// 0-parameter messages you need to use the _0 version below (since there are +// no Params in the message). #define PPAPI_DISPATCH_HOST_RESOURCE_CALL(msg_class, member_func) \ case msg_class::ID: { \ - TRACK_RUN_IN_IPC_HANDLER(member_func); \ - msg_class::Schema::Param p; \ - if (msg_class::Read(&ipc_message__, &p)) { \ - return ppapi::host::DispatchResourceCall( \ - this, \ - &_IpcMessageHandlerClass::member_func, \ - context, p); \ - } else { \ - return PP_ERROR_FAILED; \ - } \ - } \ - break; + TRACK_RUN_IN_IPC_HANDLER(member_func); \ + msg_class::Schema::Param p; \ + if (msg_class::Read(&ipc_message__, &p)) { \ + return ppapi::host::DispatchResourceCall( \ + this, \ + &_IpcMessageHandlerClass::member_func, \ + context, p); \ + } \ + return PP_ERROR_FAILED; \ + } + +#define PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(msg_class, member_func) \ + case msg_class::ID: { \ + TRACK_RUN_IN_IPC_HANDLER(member_func); \ + return member_func(context); \ + } + } // namespace host } // namespace ppapi |