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 dev/ppb_message_loop_dev.idl modified Wed Aug 29 12:22:26 2012. */ | 6 /* From ppb_message_loop.idl modified Mon Nov 12 13:33:16 2012. */ |
7 | 7 |
8 #ifndef PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_H_ | 8 #ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_ |
9 #define PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_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" |
17 | 17 |
18 #define PPB_MESSAGELOOP_DEV_INTERFACE_0_1 "PPB_MessageLoop(Dev);0.1" | 18 #define PPB_MESSAGELOOP_INTERFACE_1_0 "PPB_MessageLoop;1.0" |
19 #define PPB_MESSAGELOOP_DEV_INTERFACE PPB_MESSAGELOOP_DEV_INTERFACE_0_1 | 19 #define PPB_MESSAGELOOP_INTERFACE PPB_MESSAGELOOP_INTERFACE_1_0 |
20 | 20 |
21 /** | 21 /** |
22 * @file | 22 * @file |
23 * Defines the PPB_MessageLoop_Dev interface. | 23 * Defines the PPB_MessageLoop interface. |
24 */ | 24 */ |
25 | 25 |
26 | 26 |
27 /** | 27 /** |
28 * @addtogroup Interfaces | 28 * @addtogroup Interfaces |
29 * @{ | 29 * @{ |
30 */ | 30 */ |
31 /** | 31 /** |
32 * A message loop allows PPAPI calls to be issued on a thread. You may not | 32 * A message loop allows PPAPI calls to be issued on a thread. You may not |
33 * issue any API calls on a thread without creating a message loop. It also | 33 * issue any API calls on a thread without creating a message loop. It also |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_COMPLETIONPENDING) |
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_Dev_0_1 { | 145 struct PPB_MessageLoop_1_0 { |
146 /** | 146 /** |
147 * Creates a message loop resource. | 147 * Creates a message loop resource. |
148 * | 148 * |
149 * This may be called from any thread. After your thread starts but before | 149 * This may be called from any thread. After your thread starts but before |
150 * issuing any other PPAPI calls on it, you must associate it with a message | 150 * issuing any other PPAPI calls on it, you must associate it with a message |
151 * loop by calling AttachToCurrentThread. | 151 * loop by calling AttachToCurrentThread. |
152 */ | 152 */ |
153 PP_Resource (*Create)(PP_Instance instance); | 153 PP_Resource (*Create)(PP_Instance instance); |
154 /** | 154 /** |
155 * Returns a resource identifying the message loop for the main thread. The | 155 * Returns a resource identifying the message loop for the main thread. The |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
260 * before that point will be processed before quitting. | 260 * before that point will be processed before quitting. |
261 * | 261 * |
262 * This may be called on the message loop registered for the current thread, | 262 * This may be called on the message loop registered for the current thread, |
263 * or it may be called on the message loop registered for another thread. | 263 * or it may be called on the message loop registered for another thread. It |
| 264 * is an error to attempt to PostQuit() the main thread loop. |
264 * | 265 * |
265 * @param should_destroy Marks the message loop as being in a destroyed state | 266 * @param should_destroy Marks the message loop as being in a destroyed state |
266 * and prevents further posting of messages. | 267 * and prevents further posting of messages. |
267 * | 268 * |
268 * If you quit a message loop without setting should_destroy, it will still | 269 * If you quit a message loop without setting should_destroy, it will still |
269 * be attached to the thread and you can still run it again by calling Run() | 270 * be attached to the thread and you can still run it again by calling Run() |
270 * again. If you destroy it, it will be detached from the current thread. | 271 * again. If you destroy it, it will be detached from the current thread. |
271 * | 272 * |
272 * @return | 273 * @return |
273 * - PP_OK: The request to quit was successfully posted. | 274 * - PP_OK: The request to quit was successfully posted. |
274 * - PP_ERROR_BADRESOURCE: The message loop was invalid. | 275 * - PP_ERROR_BADRESOURCE: The message loop was invalid. |
275 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. | 276 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. |
276 * The main thread's message loop is managed by the system and can't be | 277 * The main thread's message loop is managed by the system and can't be |
277 * quit. | 278 * quit. |
278 */ | 279 */ |
279 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); | 280 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); |
280 }; | 281 }; |
281 | 282 |
282 typedef struct PPB_MessageLoop_Dev_0_1 PPB_MessageLoop_Dev; | 283 typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; |
283 /** | 284 /** |
284 * @} | 285 * @} |
285 */ | 286 */ |
286 | 287 |
287 #endif /* PPAPI_C_DEV_PPB_MESSAGE_LOOP_DEV_H_ */ | 288 #endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */ |
288 | 289 |
OLD | NEW |