| 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 pp_completion_callback.idl modified Thu Mar 28 09:51:08 2013. */ | 6 /* From pp_completion_callback.idl modified Thu Mar 28 15:25:03 2013. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_ | 8 #ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_ |
| 9 #define PPAPI_C_PP_COMPLETION_CALLBACK_H_ | 9 #define PPAPI_C_PP_COMPLETION_CALLBACK_H_ |
| 10 | 10 |
| 11 #include "ppapi/c/pp_macros.h" | 11 #include "ppapi/c/pp_macros.h" |
| 12 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * @file | 15 * @file |
| 16 * This file defines the API to create and run a callback. | 16 * This file defines the API to create and run a callback. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 * @addtogroup Structs | 85 * @addtogroup Structs |
| 86 * @{ | 86 * @{ |
| 87 */ | 87 */ |
| 88 /** | 88 /** |
| 89 * <code>PP_CompletionCallback</code> is a common mechanism for supporting | 89 * <code>PP_CompletionCallback</code> is a common mechanism for supporting |
| 90 * potentially asynchronous calls in browser interfaces. Any method that takes a | 90 * potentially asynchronous calls in browser interfaces. Any method that takes a |
| 91 * <code>PP_CompletionCallback</code> can be used in one of three different | 91 * <code>PP_CompletionCallback</code> can be used in one of three different |
| 92 * ways: | 92 * ways: |
| 93 * - Required: The callback will always be invoked asynchronously on the | 93 * - Required: The callback will always be invoked asynchronously on the |
| 94 * thread where the associated PPB method was invoked. The method | 94 * thread where the associated PPB method was invoked. The method |
| 95 * will always return <code>PP_OK_COMPLETIONPENDING</code> when a | 95 * will always return PP_OK_COMPLETIONPENDING when a required |
| 96 * required callback, and the callback will be invoked later | 96 * callback, and the callback will be invoked later (barring |
| 97 * (barring system or thread shutdown; see PPB_MessageLoop for | 97 * system or thread shutdown; see PPB_MessageLoop for details). |
| 98 * details). Required callbacks are the default. | 98 * Required callbacks are the default. |
| 99 * | 99 * |
| 100 * NOTE: If you use a required callback on a background thread, | 100 * NOTE: If you use a required callback on a background thread, |
| 101 * you must have created and attached a PPB_MessageLoop. | 101 * you must have created and attached a PPB_MessageLoop. |
| 102 * Otherwise, the system can not run your callback on that thread, | 102 * Otherwise, the system can not run your callback on that thread, |
| 103 * and will instead emit a log message and crash your plugin to | 103 * and will instead emit a log message and crash your plugin to |
| 104 * make the problem more obvious. | 104 * make the problem more obvious. |
| 105 * | 105 * |
| 106 * - Optional: The callback may be invoked asynchronously, or the PPB method | 106 * - Optional: The callback may be invoked asynchronously, or the PPB method |
| 107 * may complete synchronously if it can do so without blocking. | 107 * may complete synchronously if it can do so without blocking. |
| 108 * If the method will complete asynchronously, it will return | 108 * If the method will complete asynchronously, it will return |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 /** | 161 /** |
| 162 * @addtogroup Functions | 162 * @addtogroup Functions |
| 163 * @{ | 163 * @{ |
| 164 */ | 164 */ |
| 165 /** | 165 /** |
| 166 * PP_MakeCompletionCallback() is used to create a | 166 * PP_MakeCompletionCallback() is used to create a |
| 167 * <code>PP_CompletionCallback</code>. | 167 * <code>PP_CompletionCallback</code>. |
| 168 * | 168 * |
| 169 * <strong>Example, creating a Required callback:</strong> | 169 * <strong>Example, creating a Required callback:</strong> |
| 170 * | 170 * |
| 171 * <code> | 171 * @code |
| 172 * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); | 172 * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); |
| 173 * </code> | 173 * @endcode |
| 174 * | 174 * |
| 175 * <strong>Example, creating an Optional callback:</strong> | 175 * <strong>Example, creating an Optional callback:</strong> |
| 176 * | 176 * |
| 177 * <code> | 177 * @code |
| 178 * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); | 178 * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); |
| 179 * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; | 179 * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; |
| 180 * </code> | 180 * @endcode |
| 181 * | 181 * |
| 182 * @param[in] func A <code>PP_CompletionCallback_Func</code> that will be | 182 * @param[in] func A <code>PP_CompletionCallback_Func</code> that will be |
| 183 * called. | 183 * called. |
| 184 * @param[in] user_data A pointer to user data passed to your callback | 184 * @param[in] user_data A pointer to user data passed to your callback |
| 185 * function. This is optional and is typically used to help track state | 185 * function. This is optional and is typically used to help track state |
| 186 * when you may have multiple callbacks pending. | 186 * when you may have multiple callbacks pending. |
| 187 * | 187 * |
| 188 * @return A <code>PP_CompletionCallback</code> structure. | 188 * @return A <code>PP_CompletionCallback</code> structure. |
| 189 */ | 189 */ |
| 190 PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback( | 190 PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 struct PP_CompletionCallback temp = *cc; | 280 struct PP_CompletionCallback temp = *cc; |
| 281 *cc = PP_BlockUntilComplete(); | 281 *cc = PP_BlockUntilComplete(); |
| 282 PP_RunCompletionCallback(&temp, res); | 282 PP_RunCompletionCallback(&temp, res); |
| 283 } | 283 } |
| 284 /** | 284 /** |
| 285 * @} | 285 * @} |
| 286 */ | 286 */ |
| 287 | 287 |
| 288 #endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */ | 288 #endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */ |
| 289 | 289 |
| OLD | NEW |