Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (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 | |
|
polina
2011/03/22 22:00:59
Is this necessary at this point?
Other headers don
dmichael(do not use this one)
2011/03/23 17:03:18
Ah yes, I meant to bring this up. I found it conv
polina
2011/03/24 05:42:33
Before we start adding any such hooks to the code,
dmichael(do not use this one)
2011/03/25 20:21:05
Sure, that would be helpful.
| |
| 14 | |
| 15 /** | |
| 16 * @file | |
| 17 * This file defines the PPB_Messaging_Dev interface implemented by the browser | |
| 18 * and containing pointers to functions that are specific to a module instance | |
| 19 * and related to sending messages. | |
| 20 * | |
| 21 * @addtogroup Interfaces | |
| 22 * @{ | |
| 23 */ | |
| 24 | |
| 25 /** | |
| 26 * The PPB_Messaging_Dev interface contains pointers to functions related to | |
| 27 * sending messages for a specific module instance. | |
|
polina
2011/03/22 22:00:59
"for" is ambiguous as it can mean "to" or "from".
dmichael(do not use this one)
2011/03/23 17:03:18
Reworded.
| |
| 28 */ | |
| 29 struct PPB_Messaging_Dev { | |
| 30 /** | |
| 31 * @a PostMessage is a pointer to a function which asynchronously invokes the | |
|
polina
2011/03/22 22:00:59
I would suggest being more specific than just sayi
brettw
2011/03/23 01:59:17
Personally I think asynchronously is more clear he
dmichael(do not use this one)
2011/03/23 17:03:18
I tried to add a little wording to make it clearer
polina
2011/03/24 05:42:33
We don't have to talk about the call stack and re
dmichael(do not use this one)
2011/03/25 20:21:05
It's not just handling a response message that won
| |
| 32 * onmessage handler on the DOM element for the given module instance, if one | |
| 33 * exists. @a message is a PP_Var containing the data to be sent to | |
| 34 * JavaScript. Currently, it can have an int32_t, double, bool, or string | |
| 35 * value (objects are not currently supported.) | |
|
polina
2011/03/22 22:00:59
you have "currently" twice in the same sentence
dmichael(do not use this one)
2011/03/23 17:03:18
Fixed.
| |
| 36 * | |
| 37 * The onmessage handler in JavaScript code will receive an object conforming | |
| 38 * to the MessageEvent interface. In particular, the value of @a message will | |
| 39 * be contained as a property called @a data in the received MessageEvent. | |
| 40 * This is analogous to listening for messages from Web Workers. | |
| 41 * | |
| 42 * See: | |
| 43 * http://www.whatwg.org/specs/web-workers/current-work/ | |
| 44 * | |
| 45 * For example: | |
| 46 * | |
| 47 * \verbatim | |
| 48 * | |
| 49 * <body> | |
| 50 * <object id="plugin" | |
| 51 * type="application/x-ppapi-postMessage-example"/> | |
| 52 * <script type="text/javascript"> | |
| 53 * document.getElementById('plugin').onmessage = function(message) { | |
| 54 * alert(message.data); | |
| 55 * } | |
| 56 * </script> | |
| 57 * </body> | |
| 58 * | |
| 59 * \endverbatim | |
| 60 * | |
| 61 * If the module instance then invokes @a PostMessage() as follows: | |
| 62 * <code> | |
| 63 * char hello_world[] = "Hello world!"; | |
| 64 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance, | |
| 65 * hello_world, | |
| 66 * sizeof(hello_world)); | |
| 67 * ppb_messaging_if->PostMessage(instance, hello_var); | |
| 68 * </code> | |
| 69 * | |
| 70 * The browser will pop-up an alert saying "Hello world!". | |
| 71 */ | |
| 72 void (*PostMessage)(PP_Instance instance, struct PP_Var message); | |
| 73 }; | |
| 74 /** | |
| 75 * @} | |
| 76 */ | |
| 77 | |
| 78 #endif /* PPAPI_C_DEV_PPB_MESSAGING_DEV_H_ */ | |
| 79 | |
| OLD | NEW |