From: Pawel Wasowski Date: Fri, 6 Aug 2021 15:00:22 +0000 (+0200) Subject: [common] Add the definition of a legacy messaging interface X-Git-Tag: submit/tizen/20210806.151755^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb94647bd3c6283a8c7029e3a3d29a5f2046aed7;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [common] Add the definition of a legacy messaging interface This recent change that introduced new binary messaging interfaces, replacing XW_MESSAGING_INTERFACE_1 with XW_MESSAGING_INTERFACE_2. This chang broken the build of webapi-plugins-teec project, which depends on the declaration of the legacy interface. This commit fixes this problem, by adding the legacy interface back to XW_Extension.h. [Verification] webapi-plugins builds. webapi-plugins-teec builds, when webapi-plugins built with this change is installed in GBS root. Change-Id: Ia057a8e9ea9d51e06616a0ad16dc28b3ea342d8c --- diff --git a/src/common/XW_Extension.h b/src/common/XW_Extension.h index cc89536d..37734dd7 100644 --- a/src/common/XW_Extension.h +++ b/src/common/XW_Extension.h @@ -138,6 +138,32 @@ struct XW_CoreInterface_1 { typedef struct XW_CoreInterface_1 XW_CoreInterface; +/* + * XW_MESSAGING_INTERFACE_1 is no longer used in webapi-plugins + * but its declaration stays in this header, so that the dependencies + * of webapi-plugins-common can find the declaration in the XW_Extension.h + * they include. + */ +#define XW_MESSAGING_INTERFACE_1 "XW_MessagingInterface_1" + +typedef void (*XW_HandleMessageCallback)(XW_Instance instance, const char* message); + +struct XW_MessagingInterface_1 { + // Register a callback to be called when the JavaScript code associated + // with the extension posts a message. Note that the callback will be called + // with the XW_Instance that posted the message as well as the message + // contents. + void (*Register)(XW_Extension extension, XW_HandleMessageCallback handle_message); + + // Post a message to the web content associated with the instance. To + // receive this message the extension's JavaScript code should set a + // listener using extension.setMessageListener() function. + // + // This function is thread-safe and can be called until the instance is + // destroyed. + void (*PostMessage)(XW_Instance instance, const char* message); +}; + // // XW_MESSAGING_INTERFACE: Exchange asynchronous messages with JavaScript // code provided by extension.