PPAPI: Make PPP_MessageHandler work in PNaCl
The PNaCl ABI does not work in general with passing structs by-value.
Rather than add more complication to the shim, this changes
HandleBlockingMessage's parameter to a const-pointer param, and the return
to an out-param by pointer.
Note I wanted to pass PP_Var by const-pointer, while its "default" is
by value. So I added a new "constptr_in" param style.
(Maybe I should invert that and add a byvalue instead?)
Verified backwards compat with manual testing.
BUG=384539
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/564573002
Cr-Commit-Position: refs/heads/master@{#295341}
diff --git a/ppapi/proxy/message_handler.h b/ppapi/proxy/message_handler.h
index 61ee639..1d047bb3 100644
--- a/ppapi/proxy/message_handler.h
+++ b/ppapi/proxy/message_handler.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "ppapi/c/dev/ppb_messaging_deprecated.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/ppp_message_handler.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -43,7 +44,16 @@
// |error| is an out-param that will be set on failure.
static scoped_ptr<MessageHandler> Create(
PP_Instance instance,
- const PPP_MessageHandler_0_1* handler_if,
+ const PPP_MessageHandler_0_2* handler_if,
+ void* user_data,
+ PP_Resource message_loop,
+ int32_t* error);
+ // Provide temporary backwards compatibility. TODO(dmichael): Remove all
+ // references to PPB_Messaging_1_1 and PPP_MessageHandler_0_1.
+ // crbug.com/414398
+ static scoped_ptr<MessageHandler> CreateDeprecated(
+ PP_Instance instance,
+ const PPP_MessageHandler_0_1_Deprecated* handler_if,
void* user_data,
PP_Resource message_loop,
int32_t* error);
@@ -57,12 +67,18 @@
private:
MessageHandler(PP_Instance instance,
- const PPP_MessageHandler_0_1* handler_if,
+ const PPP_MessageHandler_0_2* handler_if,
+ void* user_data,
+ scoped_refptr<MessageLoopResource> message_loop);
+ MessageHandler(PP_Instance instance,
+ const PPP_MessageHandler_0_1_Deprecated* handler_if,
void* user_data,
scoped_refptr<MessageLoopResource> message_loop);
+
PP_Instance instance_;
- const PPP_MessageHandler_0_1* handler_if_;
+ const PPP_MessageHandler_0_2* handler_if_;
+ const PPP_MessageHandler_0_1_Deprecated* handler_if_0_1_;
void* user_data_;
scoped_refptr<MessageLoopResource> message_loop_;