Index: ppapi/c/ppb_instance.h |
=================================================================== |
--- ppapi/c/ppb_instance.h (revision 77426) |
+++ ppapi/c/ppb_instance.h (working copy) |
@@ -10,8 +10,11 @@ |
#include "ppapi/c/pp_resource.h" |
#include "ppapi/c/pp_var.h" |
-#define PPB_INSTANCE_INTERFACE "PPB_Instance;0.4" |
+#define PPB_INSTANCE_INTERFACE_0_4 "PPB_Instance;0.4" |
+#define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5" |
+#define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_5 |
+ |
/** |
* @file |
* This file defines the PPB_Instance interface implemented by the |
@@ -107,6 +110,50 @@ |
struct PP_Var (*ExecuteScript)(PP_Instance instance, |
struct PP_Var script, |
struct PP_Var* exception); |
+ |
+ /** |
+ * @a PostMessage is a pointer to a function which asynchronously invokes th |
brettw
2011/03/16 21:34:11
th -> the
dmichael(do not use this one)
2011/03/21 21:43:35
Done.
|
+ * onmessage handler on the DOM element for this module instance, if one |
+ * exists. @a message is a PP_Var containing the data to be sent to |
+ * JavaScript. Currently, it can have an int32_t, double, bool, or string |
+ * value (objects are not currently supported.) |
+ * |
+ * The onmessage handler in JavaScript code will receive an object conforming |
+ * to the MessageEvent interface. In particular, the value of @a message will |
+ * be contained as a property called @a data in the received MessageEvent. |
+ * This is analogous to listening for messages from Web Workers. |
+ * |
+ * See: |
+ * http://www.whatwg.org/specs/web-workers/current-work/ |
+ * |
+ * For example: |
+ * |
+ * \verbatim |
+ * |
+ * <body> |
+ * <object id="plugin" |
+ * type="application/x-ppapi-postMessage-example"/> |
+ * <script type="text/javascript"> |
+ * document.getElementById('plugin').onmessage = function(message) { |
+ * alert(message.data); |
+ * } |
+ * </script> |
+ * </body> |
+ * |
+ * \endverbatim |
+ * |
+ * If the module instance then invokes @a PostMessage() as follows: |
+ * <code> |
+ * 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); |
+ * </code> |
+ * |
+ * The browser will pop-up an alert saying "Hello world!". |
+ */ |
+ void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
}; |
/** |
* @} |