Index: ppapi/host/dispatch_host_message.h |
diff --git a/ppapi/host/dispatch_host_message.h b/ppapi/host/dispatch_host_message.h |
index 070b746b329fa96cb845350d4d25489bcbbfad43..9a3fae52e3721b59fa1c05a0e04d6ec94b26e0ee 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 |