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

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

Issue 13238002: [PPAPI] Documentation fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge yet again Created 7 years, 8 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
« no previous file with comments | « ppapi/c/ppb_input_event.h ('k') | ppapi/c/private/ppb_content_decryptor_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_message_loop.idl modified Thu Mar 28 11:08:46 2013. */ 6 /* From ppb_message_loop.idl modified Mon Apr 1 12:14:25 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * - Create the thread yourself (using pthreads). 48 * - Create the thread yourself (using pthreads).
49 * - Create the message loop resource. 49 * - Create the message loop resource.
50 * - Pass the message loop resource to your thread's main function. 50 * - Pass the message loop resource to your thread's main function.
51 * - Call PostWork() on the message loop to run functions on the thread. 51 * - Call PostWork() on the message loop to run functions on the thread.
52 * 52 *
53 * From the background thread's main function: 53 * From the background thread's main function:
54 * - Call AttachToCurrentThread() with the message loop resource. 54 * - Call AttachToCurrentThread() with the message loop resource.
55 * - Call Run() with the message loop resource. 55 * - Call Run() with the message loop resource.
56 * 56 *
57 * Your callbacks should look like this: 57 * Your callbacks should look like this:
58 * @code
58 * void DoMyWork(void* user_data, int32_t status) { 59 * void DoMyWork(void* user_data, int32_t status) {
59 * if (status != PP_OK) { 60 * if (status != PP_OK) {
60 * Cleanup(); // e.g. free user_data. 61 * Cleanup(); // e.g. free user_data.
61 * return; 62 * return;
62 * } 63 * }
63 * ... do your work... 64 * ... do your work...
64 * } 65 * }
66 * @endcode
65 * For a C++ example, see ppapi/utility/threading/simple_thread.h 67 * For a C++ example, see ppapi/utility/threading/simple_thread.h
66 * 68 *
67 * (You can also create the message loop resource on the background thread, 69 * (You can also create the message loop resource on the background thread,
68 * but then the main thread will have no reference to it should you want to 70 * but then the main thread will have no reference to it should you want to
69 * call PostWork()). 71 * call PostWork()).
70 * 72 *
71 * 73 *
72 * THREAD HANDLING 74 * THREAD HANDLING
73 * 75 *
74 * The main thread has an implicitly created message loop. The main thread is 76 * The main thread has an implicitly created message loop. The main thread is
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); 282 int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy);
281 }; 283 };
282 284
283 typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; 285 typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop;
284 /** 286 /**
285 * @} 287 * @}
286 */ 288 */
287 289
288 #endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */ 290 #endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */
289 291
OLDNEW
« no previous file with comments | « ppapi/c/ppb_input_event.h ('k') | ppapi/c/private/ppb_content_decryptor_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698