| Index: ppapi/c/ppb_instance.h
|
| ===================================================================
|
| --- ppapi/c/ppb_instance.h (revision 74859)
|
| +++ ppapi/c/ppb_instance.h (working copy)
|
| @@ -10,7 +10,7 @@
|
| #include "ppapi/c/pp_resource.h"
|
| #include "ppapi/c/pp_var.h"
|
|
|
| -#define PPB_INSTANCE_INTERFACE "PPB_Instance;0.4"
|
| +#define PPB_INSTANCE_INTERFACE "PPB_Instance;0.5"
|
|
|
| /**
|
| * @file
|
| @@ -82,6 +82,36 @@
|
| struct PP_Var (*ExecuteScript)(PP_Instance instance,
|
| struct PP_Var script,
|
| struct PP_Var* exception);
|
| +
|
| + /**
|
| + * PostMessage asynchronously invokes the onmessage handler of the 'embed'
|
| + * instance, if one exists. This is analogous to listening for messages from
|
| + * Web Workers.
|
| + * See:
|
| + * http://www.whatwg.org/specs/web-workers/current-work/
|
| + *
|
| + * For example:
|
| + *
|
| + * <body>
|
| + * <object id="module"
|
| + * type="application/x-ppapi-postMessage-example"/>
|
| + * <script type="text/javascript">
|
| + * document.getElementById('module').onmessage = function(message) {
|
| + * alert(message.data);
|
| + * }
|
| + * </script>
|
| + * </body>
|
| + *
|
| + * If the module then invokes PostMessage as follows:
|
| + * char hello_world[] = "Hello world!";
|
| + * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance,
|
| + * hello_world,
|
| + * sizeof(hello_world));
|
| + * the_ppb_instance->PostMessage(instance, hello_var);
|
| + *
|
| + * The browser will pop-up an alert saying "Hello world!".
|
| + */
|
| + void (*PostMessage)(PP_Instance instance, struct PP_Var message);
|
| };
|
| /**
|
| * @}
|
|
|