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

Side by Side Diff: ppapi/c/ppb_messaging.h

Issue 264303002: PPAPI: Implement synchronous postMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: defer some changes Created 6 years, 6 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
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* From ppb_messaging.idl modified Mon Jun 2 11:00:28 2014. */ 6 /* From ppb_messaging.idl modified Tue Jun 3 13:57:21 2014. */
7 7
8 #ifndef PPAPI_C_PPB_MESSAGING_H_ 8 #ifndef PPAPI_C_PPB_MESSAGING_H_
9 #define PPAPI_C_PPB_MESSAGING_H_ 9 #define PPAPI_C_PPB_MESSAGING_H_
10 10
11 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
15 #include "ppapi/c/pp_stdint.h" 15 #include "ppapi/c/pp_stdint.h"
16 #include "ppapi/c/pp_var.h" 16 #include "ppapi/c/pp_var.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 * sizeof(hello_world)); 93 * sizeof(hello_world));
94 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. 94 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var.
95 * ppb_var_interface->Release(hello_var); 95 * ppb_var_interface->Release(hello_var);
96 * 96 *
97 * @endcode 97 * @endcode
98 * 98 *
99 * The browser will pop-up an alert saying "Hello world!" 99 * The browser will pop-up an alert saying "Hello world!"
100 */ 100 */
101 void (*PostMessage)(PP_Instance instance, struct PP_Var message); 101 void (*PostMessage)(PP_Instance instance, struct PP_Var message);
102 /** 102 /**
103 * <strong>Note:</strong> This function is not yet implemented. Please use
104 * PPB_Messaging_1_0.
105 *
106 * Registers a handler for receiving messages from JavaScript. If a handler 103 * Registers a handler for receiving messages from JavaScript. If a handler
107 * is registered this way, it will replace PPP_Messaging, and all messages 104 * is registered this way, it will replace PPP_Messaging, and all messages
108 * sent from JavaScript via postMessage and postMessageAndAwaitResponse will 105 * sent from JavaScript via postMessage and postMessageAndAwaitResponse will
109 * be dispatched to <code>handler</code>. 106 * be dispatched to <code>handler</code>.
110 * 107 *
111 * The function calls will be dispatched via <code>message_loop</code>. This 108 * The function calls will be dispatched via <code>message_loop</code>. This
112 * means that the functions will be invoked on the thread to which 109 * means that the functions will be invoked on the thread to which
113 * <code>message_loop</code> is attached, when <code>message_loop</code> is 110 * <code>message_loop</code> is attached, when <code>message_loop</code> is
114 * run. It is illegal to pass the main thread message loop; 111 * run. It is illegal to pass the main thread message loop;
115 * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. 112 * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case.
(...skipping 14 matching lines...) Expand all
130 * @param[in] message_loop Represents the message loop on which 127 * @param[in] message_loop Represents the message loop on which
131 * PPP_MessageHandler functions should be invoked. 128 * PPP_MessageHandler functions should be invoked.
132 * @return PP_OK on success, or an error from pp_errors.h. 129 * @return PP_OK on success, or an error from pp_errors.h.
133 */ 130 */
134 int32_t (*RegisterMessageHandler)( 131 int32_t (*RegisterMessageHandler)(
135 PP_Instance instance, 132 PP_Instance instance,
136 void* user_data, 133 void* user_data,
137 const struct PPP_MessageHandler_0_1* handler, 134 const struct PPP_MessageHandler_0_1* handler,
138 PP_Resource message_loop); 135 PP_Resource message_loop);
139 /** 136 /**
140 * <strong>Note:</strong> This function is not yet implemented. Please use
141 * PPB_Messaging_1_0.
142 *
143 * Unregisters the current message handler for <code>instance</code> if one 137 * Unregisters the current message handler for <code>instance</code> if one
144 * is registered. After this call, the message handler (if one was 138 * is registered. After this call, the message handler (if one was
145 * registered) will have "Destroy" called on it and will receive no further 139 * registered) will have "Destroy" called on it and will receive no further
146 * messages after that point. After that point, all messages sent from 140 * messages after that point. After that point, all messages sent from
147 * JavaScript using postMessage() will be dispatched to PPP_Messaging (if 141 * JavaScript using postMessage() will be dispatched to PPP_Messaging (if
148 * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call 142 * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call
149 * postMessageAndAwaitResponse() from JavaScript will fail. 143 * postMessageAndAwaitResponse() from JavaScript will fail.
150 * 144 *
151 * Attempting to unregister a message handler when none is registered has no 145 * Attempting to unregister a message handler when none is registered has no
152 * effect. 146 * effect.
153 * 147 *
154 * @param[in] instance A <code>PP_Instance</code> identifying one instance 148 * @param[in] instance A <code>PP_Instance</code> identifying one instance
155 * of a module. 149 * of a module.
156 */ 150 */
157 void (*UnregisterMessageHandler)(PP_Instance instance); 151 void (*UnregisterMessageHandler)(PP_Instance instance);
158 }; 152 };
159 153
160 struct PPB_Messaging_1_0 { 154 struct PPB_Messaging_1_0 {
161 void (*PostMessage)(PP_Instance instance, struct PP_Var message); 155 void (*PostMessage)(PP_Instance instance, struct PP_Var message);
162 }; 156 };
163 157
164 typedef struct PPB_Messaging_1_0 PPB_Messaging; 158 typedef struct PPB_Messaging_1_0 PPB_Messaging;
165 /** 159 /**
166 * @} 160 * @}
167 */ 161 */
168 162
169 #endif /* PPAPI_C_PPB_MESSAGING_H_ */ 163 #endif /* PPAPI_C_PPB_MESSAGING_H_ */
170 164
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698