| 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 /** | 6 /** |
| 7 * Defines the PPB_MessageLoop interface. | 7 * Defines the PPB_MessageLoop interface. |
| 8 */ | 8 */ |
| 9 label Chrome { | 9 label Chrome { |
| 10 M25 = 1.0 | 10 M25 = 1.0 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 * callback. This is true even for callbacks with the "required" flag set, | 110 * callback. This is true even for callbacks with the "required" flag set, |
| 111 * since the system may not even know what thread to issue the error callback | 111 * since the system may not even know what thread to issue the error callback |
| 112 * on. | 112 * on. |
| 113 * | 113 * |
| 114 * Therefore, you should check for errors from PostWork and destroy any | 114 * Therefore, you should check for errors from PostWork and destroy any |
| 115 * associated memory to avoid leaks. If you're using the C++ | 115 * associated memory to avoid leaks. If you're using the C++ |
| 116 * CompletionCallbackFactory, use the following pattern: | 116 * CompletionCallbackFactory, use the following pattern: |
| 117 * | 117 * |
| 118 * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); | 118 * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); |
| 119 * int32_t result = message_loop.PostWork(callback); | 119 * int32_t result = message_loop.PostWork(callback); |
| 120 * if (result != PP_OK_COMPLETIONPENDING) | 120 * if (result != PP_OK) |
| 121 * callback.Run(result); | 121 * callback.Run(result); |
| 122 * | 122 * |
| 123 * This will run the callback with an error value, and assumes that the | 123 * This will run the callback with an error value, and assumes that the |
| 124 * implementation of your callback checks the "result" argument and returns | 124 * implementation of your callback checks the "result" argument and returns |
| 125 * immediately on error. | 125 * immediately on error. |
| 126 */ | 126 */ |
| 127 interface PPB_MessageLoop { | 127 interface PPB_MessageLoop { |
| 128 /** | 128 /** |
| 129 * Creates a message loop resource. | 129 * Creates a message loop resource. |
| 130 * | 130 * |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 * free this or manually run the callback. See "Desctruction and error | 224 * free this or manually run the callback. See "Desctruction and error |
| 225 * handling" above. | 225 * handling" above. |
| 226 * | 226 * |
| 227 * | 227 * |
| 228 * You can call this function before the message loop has started and the | 228 * You can call this function before the message loop has started and the |
| 229 * work will get queued until the message loop is run. You can also post | 229 * work will get queued until the message loop is run. You can also post |
| 230 * work after the message loop has exited as long as should_destroy was | 230 * work after the message loop has exited as long as should_destroy was |
| 231 * PP_FALSE. It will be queued until the next invocation of Run(). | 231 * PP_FALSE. It will be queued until the next invocation of Run(). |
| 232 * | 232 * |
| 233 * @return | 233 * @return |
| 234 * - PP_OK_COMPLETIONPENDING: The work was posted to the message loop's | 234 * - PP_OK: The work was posted to the message loop's queue. As described |
| 235 * queue. As described above, this does not mean that the work has been | 235 * above, this does not mean that the work has been or will be executed |
| 236 * or will be executed (if you never run the message loop after posting). | 236 * (if you never run the message loop after posting). |
| 237 * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. | 237 * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. |
| 238 * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback | 238 * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback |
| 239 * is null (this will be the case if you pass PP_BlockUntilComplete()). | 239 * is null (this will be the case if you pass PP_BlockUntilComplete()). |
| 240 * - PP_ERROR_FAILED: The message loop has been destroyed. | 240 * - PP_ERROR_FAILED: The message loop has been destroyed. |
| 241 */ | 241 */ |
| 242 int32_t PostWork([in] PP_Resource message_loop, | 242 int32_t PostWork([in] PP_Resource message_loop, |
| 243 [in] PP_CompletionCallback callback, | 243 [in] PP_CompletionCallback callback, |
| 244 [in] int64_t delay_ms); | 244 [in] int64_t delay_ms); |
| 245 | 245 |
| 246 /** | 246 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 260 * | 260 * |
| 261 * @return | 261 * @return |
| 262 * - PP_OK: The request to quit was successfully posted. | 262 * - PP_OK: The request to quit was successfully posted. |
| 263 * - PP_ERROR_BADRESOURCE: The message loop was invalid. | 263 * - PP_ERROR_BADRESOURCE: The message loop was invalid. |
| 264 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. | 264 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. |
| 265 * The main thread's message loop is managed by the system and can't be | 265 * The main thread's message loop is managed by the system and can't be |
| 266 * quit. | 266 * quit. |
| 267 */ | 267 */ |
| 268 int32_t PostQuit([in] PP_Resource message_loop, PP_Bool should_destroy); | 268 int32_t PostQuit([in] PP_Resource message_loop, PP_Bool should_destroy); |
| 269 }; | 269 }; |
| OLD | NEW |