Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: ppapi/c/ppb_instance.h

Issue 6538028: A proposal for an initial postMessage interface. This will allow JavaScript ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/c/ppp_instance.h » ('j') | ppapi/c/ppp_instance.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/ppb_instance.h
===================================================================
--- ppapi/c/ppb_instance.h (revision 75765)
+++ 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
@@ -107,6 +107,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'
polina 2011/02/26 08:00:08 s/'embed' instance/module instance/
dmichael(do not use this one) 2011/02/28 15:59:28 That's not quite what I was trying (badly) to conv
+ * 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"
polina 2011/02/26 08:00:08 s/module/plugin/ (You are also misusing the word "
dmichael(do not use this one) 2011/02/28 15:59:28 Done.
+ * type="application/x-ppapi-postMessage-example"/>
+ * <script type="text/javascript">
+ * document.getElementById('module').onmessage = function(message) {
+ * alert(message.data);
polina 2011/02/26 08:00:08 It would be a good idea to extend the header comme
dmichael(do not use this one) 2011/02/28 15:59:28 Done.
+ * }
+ * </script>
+ * </body>
+ *
+ * If the module then invokes PostMessage as follows:
polina 2011/02/26 08:00:08 PostMessage()
dmichael(do not use this one) 2011/02/28 15:59:28 Done. I also threw in some @a doxygen annotations
polina 2011/03/03 00:22:16 You should be consistent with whatever annotations
+ * 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);
polina 2011/02/26 08:00:08 Can this be any type of PP_Var?
dmichael(do not use this one) 2011/02/28 15:59:28 I added more information to the top-level comment.
};
/**
* @}
« no previous file with comments | « no previous file | ppapi/c/ppp_instance.h » ('j') | ppapi/c/ppp_instance.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698