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

Side by Side Diff: ppapi/c/dev/ppb_messaging_dev.h

Issue 6716005: A proposal and implementation for an initial postMessage interface. These in... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5 #ifndef PPAPI_C_DEV_PPB_MESSAGING_DEV_H_
6 #define PPAPI_C_DEV_PPB_MESSAGING_DEV_H_
7
8 #include "ppapi/c/pp_instance.h"
9 #include "ppapi/c/pp_var.h"
10
11 #define PPB_MESSAGING_DEV_INTERFACE_0_1 "PPB_Messaging(Dev);0.1"
12
13 #define PPB_MESSAGING_DEV_INTERFACE PPB_MESSAGING_DEV_INTERFACE_0_1
neb 2011/03/23 17:45:30 I agree with Polina - I'm actually against doing t
brettw 2011/03/23 17:51:39 Let's change this in a separate pass for every fil
dmichael(do not use this one) 2011/03/23 18:48:04 Okay, I made it match other interfaces.
14
15 /**
16 * @file
17 * This file defines the PPB_Messaging_Dev interface implemented by the browser.
18 * The PPB_Messaging_Dev interface contains pointers to functions related to
19 * sending messages to the JavaScript onmessage handler on the DOM element
20 * associated with a specific module instance.
21 *
22 * @addtogroup Interfaces
23 * @{
24 */
25
26 /**
27 * The PPB_Messaging_Dev interface contains pointers to functions related to
neb 2011/03/23 17:45:30 Since all our interfaces are pointers to functions
dmichael(do not use this one) 2011/03/23 18:48:04 I agree... but this is what docs folks have decid
polina 2011/03/24 05:42:33 I had the same concern in a code review I was doin
28 * sending messages to the JavaScript onmessage handler on the DOM element
29 * associated with a specific module instance.
30 */
31 struct PPB_Messaging_Dev {
32 /**
33 * @a PostMessage is a pointer to a function which asynchronously invokes the
neb 2011/03/23 17:45:30 Same as above, I think it's obvious that this is a
dmichael(do not use this one) 2011/03/23 18:48:04 Agreed, but I'm following what I think is establis
34 * onmessage handler on the DOM element for the given module instance, if one
35 * exists. This means that a call to @a PostMessage will not block while the
36 * message is processed.
37 *
38 * @a message is a PP_Var containing the data to be sent
neb 2011/03/23 17:45:30 @param?
dmichael(do not use this one) 2011/03/23 18:48:04 Done.
39 * to JavaScript. Currently, it can have an int32_t, double, bool, or string
40 * value (objects are not supported.)
41 *
42 * The onmessage handler in JavaScript code will receive an object conforming
43 * to the MessageEvent interface. In particular, the value of @a message will
44 * be contained as a property called @a data in the received MessageEvent.
45 * This is analogous to listening for messages from Web Workers.
46 *
47 * See:
48 * http://www.whatwg.org/specs/web-workers/current-work/
49 *
50 * For example:
51 *
52 * \verbatim
neb 2011/03/23 17:45:30 We're using @ elsewhere, so please use @verbratim
dmichael(do not use this one) 2011/03/23 18:48:04 Done.
53 *
54 * <body>
55 * <object id="plugin"
56 * type="application/x-ppapi-postMessage-example"/>
57 * <script type="text/javascript">
58 * document.getElementById('plugin').onmessage = function(message) {
59 * alert(message.data);
60 * }
61 * </script>
62 * </body>
63 *
64 * \endverbatim
neb 2011/03/23 17:45:30 ... and @endverbatim here.
dmichael(do not use this one) 2011/03/23 18:48:04 Done.
65 *
66 * If the module instance then invokes @a PostMessage() as follows:
67 * <code>
neb 2011/03/23 17:45:30 You used @verbatim above, now <code>?
dmichael(do not use this one) 2011/03/23 18:48:04 I'm pretty new to doxygen stuff, so I'm making my
68 * char hello_world[] = "Hello world!";
69 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance,
70 * hello_world,
71 * sizeof(hello_world));
72 * ppb_messaging_if->PostMessage(instance, hello_var);
73 * </code>
74 *
75 * The browser will pop-up an alert saying "Hello world!".
76 */
77 void (*PostMessage)(PP_Instance instance, struct PP_Var message);
78 };
79 /**
80 * @}
81 */
82
83 #endif /* PPAPI_C_DEV_PPB_MESSAGING_DEV_H_ */
84
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/dev/ppp_messaging_dev.h » ('j') | ppapi/examples/scripting/post_message.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698