Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1687)

Unified Diff: ppapi/proxy/dispatch_reply_message.h

Issue 11267034: Provide IPC mechanism for host-to-resource messaging (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: else NOTREACHED Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/host/dispatch_host_message.h ('k') | ppapi/proxy/websocket_resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/dispatch_reply_message.h
diff --git a/ppapi/proxy/dispatch_reply_message.h b/ppapi/proxy/dispatch_reply_message.h
index 3c12b1d4191906c07a62082e5d3c6c0ec01fc649..4dd5dde97945a6034b736d658b6525fd37cedf49 100644
--- a/ppapi/proxy/dispatch_reply_message.h
+++ b/ppapi/proxy/dispatch_reply_message.h
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This file provides infrastructure for dispatching host resource reply
-// messages. Normal IPC Reply handlers can't take extra parameters.
-// We want to take a ResourceMessageReplyParams as a parameter.
+// This file provides infrastructure for dispatching messasges from host
+// resource, inlcuding reply messages or unsolicited replies. Normal IPC Reply
+// handlers can't take extra parameters. We want to take a
+// ResourceMessageReplyParams as a parameter.
#ifndef PPAPI_PROXY_DISPATCH_REPLY_MESSAGE_H_
#define PPAPI_PROXY_DISPATCH_REPLY_MESSAGE_H_
@@ -29,35 +30,35 @@ template <class ObjT, class Method, class A>
inline void DispatchResourceReply(ObjT* obj, Method method,
const ResourceMessageReplyParams& params,
const Tuple1<A>& arg) {
- return (obj->*method)(params, arg.a);
+ (obj->*method)(params, arg.a);
}
template<class ObjT, class Method, class A, class B>
inline void DispatchResourceReply(ObjT* obj, Method method,
const ResourceMessageReplyParams& params,
const Tuple2<A, B>& arg) {
- return (obj->*method)(params, arg.a, arg.b);
+ (obj->*method)(params, arg.a, arg.b);
}
template<class ObjT, class Method, class A, class B, class C>
inline void DispatchResourceReply(ObjT* obj, Method method,
const ResourceMessageReplyParams& params,
const Tuple3<A, B, C>& arg) {
- return (obj->*method)(params, arg.a, arg.b, arg.c);
+ (obj->*method)(params, arg.a, arg.b, arg.c);
}
template<class ObjT, class Method, class A, class B, class C, class D>
inline void DispatchResourceReply(ObjT* obj, Method method,
const ResourceMessageReplyParams& params,
const Tuple4<A, B, C, D>& arg) {
- return (obj->*method)(params, arg.a, arg.b, arg.c, arg.d);
+ (obj->*method)(params, arg.a, arg.b, arg.c, arg.d);
}
template<class ObjT, class Method, class A, class B, class C, class D, class E>
inline void DispatchResourceReply(ObjT* obj, Method method,
const ResourceMessageReplyParams& params,
const Tuple5<A, B, C, D, E>& arg) {
- return (obj->*method)(params, arg.a, arg.b, arg.c, arg.d, arg.e);
+ (obj->*method)(params, arg.a, arg.b, arg.c, arg.d, arg.e);
}
// Used to dispatch resource replies. In most cases, you should not call this
@@ -124,9 +125,38 @@ void DispatchResourceReplyOrDefaultParams(
const IPC::Message& msg) {
DCHECK(msg.type() == MsgClass::ID || msg.type() == 0)
<< "Resource reply message of unexpected type.";
- return (obj->*method)(reply_params);
+ (obj->*method)(reply_params);
}
+// 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_PLUGIN_RESOURCE_CALL(msg_class, member_func) \
+ case msg_class::ID: { \
+ msg_class::Schema::Param p; \
+ if (msg_class::Read(&ipc_message__, &p)) { \
+ ppapi::proxy::DispatchResourceReply( \
+ this, \
+ &_IpcMessageHandlerClass::member_func, \
+ params, p); \
+ } else { \
+ NOTREACHED(); \
+ } \
+ break; \
+ }
+
+#define PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_0(msg_class, member_func) \
+ case msg_class::ID: { \
+ member_func(params); \
+ break; \
+ }
+
+#define PPAPI_DISPATCH_PLUGIN_RESOURCE_CALL_UNHANDLED(code) \
+ default: { \
+ code; \
+ } \
+ break;
+
} // namespace proxy
} // namespace ppapi
« no previous file with comments | « ppapi/host/dispatch_host_message.h ('k') | ppapi/proxy/websocket_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698