| Index: ppapi/api/ppb_messaging.idl
|
| diff --git a/ppapi/api/ppb_messaging.idl b/ppapi/api/ppb_messaging.idl
|
| index 0f9a3aa8c2bbeb49c2341179e49771534a01a5a5..4008d730c4b55b6f0a671c7d6a307775a9ef4941 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,
|
| + M36 = 1.1
|
| };
|
|
|
| /**
|
| @@ -20,6 +21,7 @@ label Chrome {
|
| * and is related to sending messages to JavaScript message event listeners on
|
| * the DOM element associated with specific module instance.
|
| */
|
| +[version=1.0]
|
| interface PPB_Messaging {
|
| /**
|
| * PostMessage() asynchronously invokes any listeners for message events on
|
| @@ -82,5 +84,55 @@ interface PPB_Messaging {
|
| * The browser will pop-up an alert saying "Hello world!"
|
| */
|
| void PostMessage([in] PP_Instance instance, [in] PP_Var message);
|
| +
|
| + /**
|
| + * Call this to prepare to receive a blocking message from JavaScript.
|
| + * When JavaScript invokes postMessageAndAwaitResponse(), the callback will
|
| + * be invoked (or, if a blocking completion callback was used,
|
| + * WaitForBlockingMessage will return).
|
| + *
|
| + * When the call completes, |message| will be a PP_Var containing a copy of
|
| + * the data passed from JavaScript to postMessageAndAwaitResponse().
|
| + *
|
| + * Upon receipt of the callback, the plugin must respond to the plugin by
|
| + * calling RespondToBlockingMessage. The JavaScript invocation of
|
| + * postMessageAndAwaitResponse will not return until the response is
|
| + * received, so it is important to respond quickly.
|
| + *
|
| + * Invocations of WaitForBlockingMessage will fail if JavaScript is still
|
| + * awaiting a response to a prior invocation of the callback. Therefore, the
|
| + * plugin must always call RespondToBlockingMessage before calling
|
| + * WaitForBlockingMessage again.
|
| + *
|
| + * Example usage:
|
| + * void thread_func() {
|
| + * while (!ShouldQuit()) {
|
| + * PP_Var param = PP_MakeUndefined();
|
| + * WaitForBlockingMessage(pp_instance, ¶m,
|
| + * PP_BlockUntilComplete());
|
| + * PP_Var response = ComputeSomething(param);
|
| + * RespondToBlockingMessage(pp_instance, response);
|
| + * var_if.Release(param);
|
| + * var_if.Release(response);
|
| + * }
|
| + * }
|
| + *
|
| + * WaitForBlockingMessage will only work if called from a background thread.
|
| + * If it is invoked from the main Pepper thread, the result will be
|
| + * PP_ERROR_WRONG_THREAD.
|
| + */
|
| + [version=1.1]
|
| + int32_t WaitForBlockingMessage([in] PP_Instance instance,
|
| + [out] PP_Var message,
|
| + [in] PP_CompletionCallback callback);
|
| + /**
|
| + * Send a response to JavaScript. This only makes sense if JavaScript is
|
| + * currently blocked on postMessagAndAwaitResponse. JavaScript's
|
| + * postMessageAndAwaitResponse function will return a JavaScript value
|
| + * representing a copy of |response|.
|
| + */
|
| + [version=1.1]
|
| + void RespondToBlockingMessage([in] PP_Instance instance,
|
| + [in] PP_Var response);
|
| };
|
|
|
|
|