diff options
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.cc | 15 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.h | 5 | ||||
-rw-r--r-- | mojo/examples/pepper_container_app/plugin_instance.cc | 13 | ||||
-rw-r--r-- | mojo/examples/pepper_container_app/plugin_instance.h | 5 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/ppapi/library.dsc | 1 | ||||
-rw-r--r-- | ppapi/api/ppb_messaging.idl | 62 | ||||
-rw-r--r-- | ppapi/api/ppp_message_handler.idl | 70 | ||||
-rw-r--r-- | ppapi/c/ppb_messaging.h | 67 | ||||
-rw-r--r-- | ppapi/c/ppp_message_handler.h | 87 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 37 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 12 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.h | 5 | ||||
-rw-r--r-- | ppapi/tests/all_c_includes.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/ppb_instance_api.h | 6 | ||||
-rw-r--r-- | ppapi/thunk/ppb_messaging_thunk.cc | 34 |
15 files changed, 416 insertions, 4 deletions
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index c1bc651..573831d 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -1305,6 +1305,21 @@ void PepperPluginInstanceImpl::PostMessageToJavaScript(PP_Var message) { message_channel_->PostMessageToJavaScript(message); } +int32_t PepperPluginInstanceImpl::RegisterMessageHandler( + PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) { + // Not supported in-process. + NOTIMPLEMENTED(); + return PP_ERROR_FAILED; +} + +void PepperPluginInstanceImpl::UnregisterMessageHandler(PP_Instance instance) { + // Not supported in-process. + NOTIMPLEMENTED(); +} + base::string16 PepperPluginInstanceImpl::GetSelectedText(bool html) { // Keep a reference on the stack. See NOTE above. scoped_refptr<PepperPluginInstanceImpl> ref(this); diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index 9d067a9..c4874bf 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -411,6 +411,11 @@ class CONTENT_EXPORT PepperPluginInstanceImpl double minimum_factor, double maximum_factor) OVERRIDE; virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE; + virtual int32_t RegisterMessageHandler(PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) OVERRIDE; + virtual void UnregisterMessageHandler(PP_Instance instance) OVERRIDE; virtual PP_Bool SetCursor(PP_Instance instance, PP_MouseCursor_Type type, PP_Resource image, diff --git a/mojo/examples/pepper_container_app/plugin_instance.cc b/mojo/examples/pepper_container_app/plugin_instance.cc index d4b79625..ba828a2 100644 --- a/mojo/examples/pepper_container_app/plugin_instance.cc +++ b/mojo/examples/pepper_container_app/plugin_instance.cc @@ -226,6 +226,19 @@ void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { NOTIMPLEMENTED(); } +int32_t PluginInstance::RegisterMessageHandler( + PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) { + NOTIMPLEMENTED(); + return PP_ERROR_FAILED; +} + +void PluginInstance::UnregisterMessageHandler(PP_Instance instance) { + NOTIMPLEMENTED(); +} + PP_Bool PluginInstance::SetCursor(PP_Instance instance, PP_MouseCursor_Type type, PP_Resource image, diff --git a/mojo/examples/pepper_container_app/plugin_instance.h b/mojo/examples/pepper_container_app/plugin_instance.h index e7f3434..eadd256 100644 --- a/mojo/examples/pepper_container_app/plugin_instance.h +++ b/mojo/examples/pepper_container_app/plugin_instance.h @@ -83,6 +83,11 @@ class PluginInstance : public ppapi::thunk::PPB_Instance_API { uint32_t event_classes) OVERRIDE; virtual void StartTrackingLatency(PP_Instance instance) OVERRIDE; virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE; + virtual int32_t RegisterMessageHandler(PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) OVERRIDE; + virtual void UnregisterMessageHandler(PP_Instance instance) OVERRIDE; virtual PP_Bool SetCursor(PP_Instance instance, PP_MouseCursor_Type type, PP_Resource image, diff --git a/native_client_sdk/src/libraries/ppapi/library.dsc b/native_client_sdk/src/libraries/ppapi/library.dsc index 7f96b9b..61f6cac 100644 --- a/native_client_sdk/src/libraries/ppapi/library.dsc +++ b/native_client_sdk/src/libraries/ppapi/library.dsc @@ -77,6 +77,7 @@ 'ppp.h', 'ppp_input_event.h', 'ppp_instance.h', + 'ppp_message_handler.h', 'ppp_messaging.h', 'ppp_mouse_lock.h', 'pp_point.h', diff --git a/ppapi/api/ppb_messaging.idl b/ppapi/api/ppb_messaging.idl index 0f9a3aa..dc50788 100644 --- a/ppapi/api/ppb_messaging.idl +++ b/ppapi/api/ppb_messaging.idl @@ -12,7 +12,8 @@ [generate_thunk] label Chrome { - M14 = 1.0 + M14 = 1.0, + [channel=dev] M37 = 1.1 }; /** @@ -81,6 +82,65 @@ interface PPB_Messaging { * * The browser will pop-up an alert saying "Hello world!" */ + [version=1.0] void PostMessage([in] PP_Instance instance, [in] PP_Var message); + + /** + * <strong>Note:</strong> This function is not yet implemented. Please use + * PPB_Messaging_1_0. + * + * Registers a handler for receiving messages from JavaScript. If a handler + * is registered this way, it will replace PPP_Messaging, and all messages + * sent from JavaScript via postMessage and postMessageAndAwaitResponse will + * be dispatched to <code>handler</code>. + * + * The function calls will be dispatched via <code>message_loop</code>. This + * means that the functions will be invoked on the thread to which + * <code>message_loop</code> is attached, when <code>message_loop</code> is + * run. It is illegal to pass the main thread message loop; + * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. + * + * Attempting to register a message handler when one is already registered + * will cause the current MessageHandler to be unregistered and replaced. In + * that case, no messages will be sent to the "default" message handler + * (PPP_Messaging). Messages will stop arriving at the prior message handler + * and will begin to be dispatched at the new message handler. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data A pointer the plugin may choose to use when handling + * calls to functions within PPP_MessageHandler. The browser will pass this + * same pointer when invoking functions within PPP_MessageHandler. + * @param[in] handler The plugin-provided set of functions for handling + * messages. + * @param[in] message_loop Represents the message loop on which + * PPP_MessageHandler functions should be invoked. + * @return PP_OK on success, or an error from pp_errors.h. + */ + [version=1.1] + int32_t RegisterMessageHandler([in] PP_Instance instance, + [inout] mem_t user_data, + [in] PPP_MessageHandler handler, + [in] PP_Resource message_loop); + /** + * <strong>Note:</strong> This function is not yet implemented. Please use + * PPB_Messaging_1_0. + * + * Unregisters the current message handler for <code>instance</code> if one + * is registered. After this call, the message handler (if one was + * registered) will have "Destroy" called on it and will receive no further + * messages after that point. After that point, all messages sent from + * JavaScript using postMessage() will be dispatched to PPP_Messaging (if + * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call + * postMessageAndAwaitResponse() from JavaScript will fail. + * + * Attempting to unregister a message handler when none is registered has no + * effect. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + [version=1.1] + void UnregisterMessageHandler([in] PP_Instance instance); }; diff --git a/ppapi/api/ppp_message_handler.idl b/ppapi/api/ppp_message_handler.idl new file mode 100644 index 0000000..d08afcf --- /dev/null +++ b/ppapi/api/ppp_message_handler.idl @@ -0,0 +1,70 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the <code>PPP_MessageHandler</code> interface that plugins + * can implement and register using PPB_Messaging::RegisterMessageHandler in + * order to handle messages sent from JavaScript via postMessage() or + * postMessageAndAwaitResponse(). + */ + +label Chrome { + [channel=none] M37 = 0.1 +}; + +/** + * The <code>PPP_MessageHandler</code> interface is implemented by the plugin + * if the plugin wants to receive messages from a thread other than the main + * Pepper thread, or if the plugin wants to handle blocking messages which + * JavaScript may send via postMessageAndAwaitResponse(). + * + * This interface struct should not be returned by PPP_GetInterface; instead it + * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. + */ +[no_interface_string] +interface PPP_MessageHandler { + /** + * Invoked as a result of JavaScript invoking postMessage() on the plugin's + * DOM element. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + * @param[in] message A copy of the parameter that JavaScript provided to + * postMessage(). + */ + void HandleMessage([in] PP_Instance instance, + [in] mem_t user_data, + [in] PP_Var message); + /** + * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() + * on the plugin's DOM element. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + * @param[in] message is a copy of the parameter that JavaScript provided + * to postMessageAndAwaitResponse. + * @return will be copied to a JavaScript object which is returned as + * the result of postMessageAndAwaitResponse to the invoking JavaScript. + */ + PP_Var HandleBlockingMessage([in] PP_Instance instance, + [inout] mem_t user_data, + [in] PP_Var message); + /** + * Invoked when the handler object is no longer needed. After this, no more + * calls will be made which pass this same value for <code>instance</code> + * and <code>user_data</code>. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + */ + void Destroy([in] PP_Instance instance, [inout] mem_t user_data); +}; + diff --git a/ppapi/c/ppb_messaging.h b/ppapi/c/ppb_messaging.h index 06e31205..21c8467 100644 --- a/ppapi/c/ppb_messaging.h +++ b/ppapi/c/ppb_messaging.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_messaging.idl modified Wed Jun 5 10:32:59 2013. */ +/* From ppb_messaging.idl modified Mon Jun 2 11:00:28 2014. */ #ifndef PPAPI_C_PPB_MESSAGING_H_ #define PPAPI_C_PPB_MESSAGING_H_ @@ -11,10 +11,13 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" +#include "ppapi/c/ppp_message_handler.h" #define PPB_MESSAGING_INTERFACE_1_0 "PPB_Messaging;1.0" +#define PPB_MESSAGING_INTERFACE_1_1 "PPB_Messaging;1.1" /* dev */ #define PPB_MESSAGING_INTERFACE PPB_MESSAGING_INTERFACE_1_0 /** @@ -34,7 +37,7 @@ * and is related to sending messages to JavaScript message event listeners on * the DOM element associated with specific module instance. */ -struct PPB_Messaging_1_0 { +struct PPB_Messaging_1_1 { /* dev */ /** * PostMessage() asynchronously invokes any listeners for message events on * the DOM element for the given module instance. A call to PostMessage() @@ -96,6 +99,66 @@ struct PPB_Messaging_1_0 { * The browser will pop-up an alert saying "Hello world!" */ void (*PostMessage)(PP_Instance instance, struct PP_Var message); + /** + * <strong>Note:</strong> This function is not yet implemented. Please use + * PPB_Messaging_1_0. + * + * Registers a handler for receiving messages from JavaScript. If a handler + * is registered this way, it will replace PPP_Messaging, and all messages + * sent from JavaScript via postMessage and postMessageAndAwaitResponse will + * be dispatched to <code>handler</code>. + * + * The function calls will be dispatched via <code>message_loop</code>. This + * means that the functions will be invoked on the thread to which + * <code>message_loop</code> is attached, when <code>message_loop</code> is + * run. It is illegal to pass the main thread message loop; + * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. + * + * Attempting to register a message handler when one is already registered + * will cause the current MessageHandler to be unregistered and replaced. In + * that case, no messages will be sent to the "default" message handler + * (PPP_Messaging). Messages will stop arriving at the prior message handler + * and will begin to be dispatched at the new message handler. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data A pointer the plugin may choose to use when handling + * calls to functions within PPP_MessageHandler. The browser will pass this + * same pointer when invoking functions within PPP_MessageHandler. + * @param[in] handler The plugin-provided set of functions for handling + * messages. + * @param[in] message_loop Represents the message loop on which + * PPP_MessageHandler functions should be invoked. + * @return PP_OK on success, or an error from pp_errors.h. + */ + int32_t (*RegisterMessageHandler)( + PP_Instance instance, + void* user_data, + const struct PPP_MessageHandler_0_1* handler, + PP_Resource message_loop); + /** + * <strong>Note:</strong> This function is not yet implemented. Please use + * PPB_Messaging_1_0. + * + * Unregisters the current message handler for <code>instance</code> if one + * is registered. After this call, the message handler (if one was + * registered) will have "Destroy" called on it and will receive no further + * messages after that point. After that point, all messages sent from + * JavaScript using postMessage() will be dispatched to PPP_Messaging (if + * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call + * postMessageAndAwaitResponse() from JavaScript will fail. + * + * Attempting to unregister a message handler when none is registered has no + * effect. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + void (*UnregisterMessageHandler)(PP_Instance instance); +}; + +struct PPB_Messaging_1_0 { + void (*PostMessage)(PP_Instance instance, struct PP_Var message); }; typedef struct PPB_Messaging_1_0 PPB_Messaging; diff --git a/ppapi/c/ppp_message_handler.h b/ppapi/c/ppp_message_handler.h new file mode 100644 index 0000000..26cd5e0 --- /dev/null +++ b/ppapi/c/ppp_message_handler.h @@ -0,0 +1,87 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_message_handler.idl modified Fri May 30 15:49:17 2014. */ + +#ifndef PPAPI_C_PPP_MESSAGE_HANDLER_H_ +#define PPAPI_C_PPP_MESSAGE_HANDLER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +/** + * @file + * This file defines the <code>PPP_MessageHandler</code> interface that plugins + * can implement and register using PPB_Messaging::RegisterMessageHandler in + * order to handle messages sent from JavaScript via postMessage() or + * postMessageAndAwaitResponse(). + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPP_MessageHandler</code> interface is implemented by the plugin + * if the plugin wants to receive messages from a thread other than the main + * Pepper thread, or if the plugin wants to handle blocking messages which + * JavaScript may send via postMessageAndAwaitResponse(). + * + * This interface struct should not be returned by PPP_GetInterface; instead it + * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. + */ +struct PPP_MessageHandler_0_1 { + /** + * Invoked as a result of JavaScript invoking postMessage() on the plugin's + * DOM element. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + * @param[in] message A copy of the parameter that JavaScript provided to + * postMessage(). + */ + void (*HandleMessage)(PP_Instance instance, + const void* user_data, + struct PP_Var message); + /** + * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() + * on the plugin's DOM element. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + * @param[in] message is a copy of the parameter that JavaScript provided + * to postMessageAndAwaitResponse. + * @return will be copied to a JavaScript object which is returned as + * the result of postMessageAndAwaitResponse to the invoking JavaScript. + */ + struct PP_Var (*HandleBlockingMessage)(PP_Instance instance, + void* user_data, + struct PP_Var message); + /** + * Invoked when the handler object is no longer needed. After this, no more + * calls will be made which pass this same value for <code>instance</code> + * and <code>user_data</code>. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + */ + void (*Destroy)(PP_Instance instance, void* user_data); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_MESSAGE_HANDLER_H_ */ + diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 481f7d2..6ca478a 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -119,6 +119,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MediaStreamVideoTrack_0_1 static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MediaStreamVideoTrack_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MessageLoop_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseLock_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetAddress_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_NetworkList_1_0; @@ -1185,6 +1186,25 @@ static void Pnacl_M14_PPB_Messaging_PostMessage(PP_Instance instance, struct PP_ /* End wrapper methods for PPB_Messaging_1_0 */ +/* Begin wrapper methods for PPB_Messaging_1_1 */ + +static void Pnacl_M37_PPB_Messaging_PostMessage(PP_Instance instance, struct PP_Var* message) { + const struct PPB_Messaging_1_1 *iface = Pnacl_WrapperInfo_PPB_Messaging_1_1.real_iface; + iface->PostMessage(instance, *message); +} + +static int32_t Pnacl_M37_PPB_Messaging_RegisterMessageHandler(PP_Instance instance, void* user_data, const struct PPP_MessageHandler_0_1* handler, PP_Resource message_loop) { + const struct PPB_Messaging_1_1 *iface = Pnacl_WrapperInfo_PPB_Messaging_1_1.real_iface; + return iface->RegisterMessageHandler(instance, user_data, handler, message_loop); +} + +static void Pnacl_M37_PPB_Messaging_UnregisterMessageHandler(PP_Instance instance) { + const struct PPB_Messaging_1_1 *iface = Pnacl_WrapperInfo_PPB_Messaging_1_1.real_iface; + iface->UnregisterMessageHandler(instance); +} + +/* End wrapper methods for PPB_Messaging_1_1 */ + /* Not generating wrapper methods for PPB_MouseCursor_1_0 */ /* Begin wrapper methods for PPB_MouseLock_1_0 */ @@ -1896,6 +1916,8 @@ static void Pnacl_M18_PPB_WebSocket_GetURL(struct PP_Var* _struct_result, PP_Res /* Not generating wrapper methods for PPP_Instance_1_1 */ +/* Not generating wrapper methods for PPP_MessageHandler_0_1 */ + /* Begin wrapper methods for PPP_Messaging_1_0 */ static void Pnacl_M14_PPP_Messaging_HandleMessage(PP_Instance instance, struct PP_Var message) { @@ -4516,6 +4538,12 @@ static const struct PPB_Messaging_1_0 Pnacl_Wrappers_PPB_Messaging_1_0 = { .PostMessage = (void (*)(PP_Instance instance, struct PP_Var message))&Pnacl_M14_PPB_Messaging_PostMessage }; +static const struct PPB_Messaging_1_1 Pnacl_Wrappers_PPB_Messaging_1_1 = { + .PostMessage = (void (*)(PP_Instance instance, struct PP_Var message))&Pnacl_M37_PPB_Messaging_PostMessage, + .RegisterMessageHandler = (int32_t (*)(PP_Instance instance, void* user_data, const struct PPP_MessageHandler_0_1* handler, PP_Resource message_loop))&Pnacl_M37_PPB_Messaging_RegisterMessageHandler, + .UnregisterMessageHandler = (void (*)(PP_Instance instance))&Pnacl_M37_PPB_Messaging_UnregisterMessageHandler +}; + /* Not generating wrapper interface for PPB_MouseCursor_1_0 */ static const struct PPB_MouseLock_1_0 Pnacl_Wrappers_PPB_MouseLock_1_0 = { @@ -4715,6 +4743,8 @@ static const struct PPB_WebSocket_1_0 Pnacl_Wrappers_PPB_WebSocket_1_0 = { /* Not generating wrapper interface for PPP_Instance_1_1 */ +/* Not generating wrapper interface for PPP_MessageHandler_0_1 */ + static const struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = { .HandleMessage = &Pnacl_M14_PPP_Messaging_HandleMessage }; @@ -5526,6 +5556,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_0 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Messaging_1_1 = { + .iface_macro = PPB_MESSAGING_INTERFACE_1_1, + .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_Messaging_1_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_MouseLock_1_0 = { .iface_macro = PPB_MOUSELOCK_INTERFACE_1_0, .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_MouseLock_1_0, @@ -6026,6 +6062,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_MediaStreamVideoTrack_1_0, &Pnacl_WrapperInfo_PPB_MessageLoop_1_0, &Pnacl_WrapperInfo_PPB_Messaging_1_0, + &Pnacl_WrapperInfo_PPB_Messaging_1_1, &Pnacl_WrapperInfo_PPB_MouseLock_1_0, &Pnacl_WrapperInfo_PPB_NetAddress_1_0, &Pnacl_WrapperInfo_PPB_NetworkList_1_0, diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 93e6660..a0b4ca3 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -740,6 +740,18 @@ void PPB_Instance_Proxy::PostMessage(PP_Instance instance, instance, SerializedVarSendInputShmem(dispatcher(), message, instance))); } +int32_t PPB_Instance_Proxy::RegisterMessageHandler( + PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) { + // Not yet implemented. See crbug.com/367896 + return PP_ERROR_NOTSUPPORTED; +} + +void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { + // Not yet implemented. See crbug.com/367896 +} PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, PP_MouseCursor_Type type, diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 4a6d7f2..abec352 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -86,6 +86,11 @@ class PPB_Instance_Proxy : public InterfaceProxy, double minimum_factor, double maximium_factor) OVERRIDE; virtual void PostMessage(PP_Instance instance, PP_Var message) OVERRIDE; + virtual int32_t RegisterMessageHandler(PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) OVERRIDE; + virtual void UnregisterMessageHandler(PP_Instance instance) OVERRIDE; virtual PP_Bool SetCursor(PP_Instance instance, PP_MouseCursor_Type type, PP_Resource image, diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 611d72c..f8115cb 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -100,6 +100,7 @@ #include "ppapi/c/ppp_graphics_3d.h" #include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/ppp_message_handler.h" #include "ppapi/c/ppp_messaging.h" #include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/pp_private_font_charset.h" diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index db73979..39ea9e4 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -30,6 +30,7 @@ struct PP_DecryptedBlockInfo; struct PP_DecryptedFrameInfo; +struct PPP_MessageHandler_0_1; namespace ppapi { @@ -114,6 +115,11 @@ class PPB_Instance_API { // Messaging. virtual void PostMessage(PP_Instance instance, PP_Var message) = 0; + virtual int32_t RegisterMessageHandler(PP_Instance instance, + void* user_data, + const PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) = 0; + virtual void UnregisterMessageHandler(PP_Instance instance) = 0; // Mouse cursor. virtual PP_Bool SetCursor(PP_Instance instance, diff --git a/ppapi/thunk/ppb_messaging_thunk.cc b/ppapi/thunk/ppb_messaging_thunk.cc index fb936b8..c351233 100644 --- a/ppapi/thunk/ppb_messaging_thunk.cc +++ b/ppapi/thunk/ppb_messaging_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_messaging.idl modified Tue Aug 20 08:13:36 2013. +// From ppb_messaging.idl modified Thu May 29 15:54:46 2014. #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_messaging.h" @@ -23,15 +23,47 @@ void PostMessage(PP_Instance instance, struct PP_Var message) { enter.functions()->PostMessage(instance, message); } +int32_t RegisterMessageHandler(PP_Instance instance, + void* user_data, + const struct PPP_MessageHandler_0_1* handler, + PP_Resource message_loop) { + VLOG(4) << "PPB_Messaging::RegisterMessageHandler()"; + EnterInstance enter(instance); + if (enter.failed()) + return enter.retval(); + return enter.functions()->RegisterMessageHandler(instance, + user_data, + handler, + message_loop); +} + +void UnregisterMessageHandler(PP_Instance instance) { + VLOG(4) << "PPB_Messaging::UnregisterMessageHandler()"; + EnterInstance enter(instance); + if (enter.failed()) + return; + enter.functions()->UnregisterMessageHandler(instance); +} + const PPB_Messaging_1_0 g_ppb_messaging_thunk_1_0 = { &PostMessage }; +const PPB_Messaging_1_1 g_ppb_messaging_thunk_1_1 = { + &PostMessage, + &RegisterMessageHandler, + &UnregisterMessageHandler +}; + } // namespace PPAPI_THUNK_EXPORT const PPB_Messaging_1_0* GetPPB_Messaging_1_0_Thunk() { return &g_ppb_messaging_thunk_1_0; } +PPAPI_THUNK_EXPORT const PPB_Messaging_1_1* GetPPB_Messaging_1_1_Thunk() { + return &g_ppb_messaging_thunk_1_1; +} + } // namespace thunk } // namespace ppapi |