OLD | NEW |
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_message_loop.idl modified Tue Nov 20 08:49:26 2012. */ | 6 /* From ppb_message_loop.idl modified Thu Jan 17 12:04:14 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_ | 8 #ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_ |
9 #define PPAPI_C_PPB_MESSAGE_LOOP_H_ | 9 #define PPAPI_C_PPB_MESSAGE_LOOP_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_macros.h" | 14 #include "ppapi/c/pp_macros.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 * callback. This is true even for callbacks with the "required" flag set, | 128 * callback. This is true even for callbacks with the "required" flag set, |
129 * since the system may not even know what thread to issue the error callback | 129 * since the system may not even know what thread to issue the error callback |
130 * on. | 130 * on. |
131 * | 131 * |
132 * Therefore, you should check for errors from PostWork and destroy any | 132 * Therefore, you should check for errors from PostWork and destroy any |
133 * associated memory to avoid leaks. If you're using the C++ | 133 * associated memory to avoid leaks. If you're using the C++ |
134 * CompletionCallbackFactory, use the following pattern: | 134 * CompletionCallbackFactory, use the following pattern: |
135 * | 135 * |
136 * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); | 136 * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); |
137 * int32_t result = message_loop.PostWork(callback); | 137 * int32_t result = message_loop.PostWork(callback); |
138 * if (result != PP_OK_COMPLETIONPENDING) | 138 * if (result != PP_OK) |
139 * callback.Run(result); | 139 * callback.Run(result); |
140 * | 140 * |
141 * This will run the callback with an error value, and assumes that the | 141 * This will run the callback with an error value, and assumes that the |
142 * implementation of your callback checks the "result" argument and returns | 142 * implementation of your callback checks the "result" argument and returns |
143 * immediately on error. | 143 * immediately on error. |
144 */ | 144 */ |
145 struct PPB_MessageLoop_1_0 { | 145 struct PPB_MessageLoop_1_0 { |
146 /** | 146 /** |
147 * Creates a message loop resource. | 147 * Creates a message loop resource. |
148 * | 148 * |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 * free this or manually run the callback. See "Desctruction and error | 237 * free this or manually run the callback. See "Desctruction and error |
238 * handling" above. | 238 * handling" above. |
239 * | 239 * |
240 * | 240 * |
241 * You can call this function before the message loop has started and the | 241 * You can call this function before the message loop has started and the |
242 * work will get queued until the message loop is run. You can also post | 242 * work will get queued until the message loop is run. You can also post |
243 * work after the message loop has exited as long as should_destroy was | 243 * work after the message loop has exited as long as should_destroy was |
244 * PP_FALSE. It will be queued until the next invocation of Run(). | 244 * PP_FALSE. It will be queued until the next invocation of Run(). |
245 * | 245 * |
246 * @return | 246 * @return |
247 * - PP_OK_COMPLETIONPENDING: The work was posted to the message loop's | 247 * - PP_OK: The work was posted to the message loop's queue. As described |
248 * queue. As described above, this does not mean that the work has been | 248 * above, this does not mean that the work has been or will be executed |
249 * or will be executed (if you never run the message loop after posting). | 249 * (if you never run the message loop after posting). |
250 * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. | 250 * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. |
251 * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback | 251 * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback |
252 * is null (this will be the case if you pass PP_BlockUntilComplete()). | 252 * is null (this will be the case if you pass PP_BlockUntilComplete()). |
253 * - PP_ERROR_FAILED: The message loop has been destroyed. | 253 * - PP_ERROR_FAILED: The message loop has been destroyed. |
254 */ | 254 */ |
255 int32_t (*PostWork)(PP_Resource message_loop, | 255 int32_t (*PostWork)(PP_Resource message_loop, |
256 struct PP_CompletionCallback callback, | 256 struct PP_CompletionCallback callback, |
257 int64_t delay_ms); | 257 int64_t delay_ms); |
258 /** | 258 /** |
259 * Posts a quit message to the given message loop's work queue. Work posted | 259 * Posts a quit message to the given message loop's work queue. Work posted |
(...skipping 20 matching lines...) Expand all Loading... |
280 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); | 280 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); |
281 }; | 281 }; |
282 | 282 |
283 typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; | 283 typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; |
284 /** | 284 /** |
285 * @} | 285 * @} |
286 */ | 286 */ |
287 | 287 |
288 #endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */ | 288 #endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */ |
289 | 289 |
OLD | NEW |