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

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

Issue 7399016: More trivial cleanupi of ppapi/c headers (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/pp_bool.h ('k') | ppapi/c/pp_errors.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) 2011 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2011 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
6 /* From pp_completion_callback.idl modified Sat Jul 16 16:50:26 2011. */
7
5 #ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_ 8 #ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_
6 #define PPAPI_C_PP_COMPLETION_CALLBACK_H_ 9 #define PPAPI_C_PP_COMPLETION_CALLBACK_H_
7 10
11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_stdint.h"
13
8 /** 14 /**
9 * @file 15 * @file
10 * This file defines the API to create and run a callback. 16 * This file defines the API to create and run a callback.
11 */ 17 */
12 18
13 #include <stdlib.h>
14
15 #include "ppapi/c/pp_macros.h"
16 #include "ppapi/c/pp_stdint.h"
17 19
18 /** 20 /**
19 * @addtogroup Typedefs 21 * @addtogroup Typedefs
20 * @{ 22 * @{
21 */ 23 */
22
23 /** 24 /**
24 * PP_CompletionCallback_Func defines the function signature that you implement 25 * PP_CompletionCallback_Func defines the function signature that you implement
25 * to receive callbacks on asynchronous completion of an operation. 26 * to receive callbacks on asynchronous completion of an operation.
26 * 27 *
27 * |user_data| is a pointer to user-specified data associated with this 28 * |user_data| is a pointer to user-specified data associated with this
28 * function at callback creation. See PP_MakeCompletionCallback() for details. 29 * function at callback creation. See PP_MakeCompletionCallback() for details.
29 * 30 *
30 * |result| is the result of the operation. Non-positive values correspond to 31 * |result| is the result of the operation. Non-positive values correspond to
31 * the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING). 32 * the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING).
32 * Positive values indicate additional information such as bytes read. 33 * Positive values indicate additional information such as bytes read.
33 */ 34 */
34 typedef void (*PP_CompletionCallback_Func)(void* user_data, int32_t result); 35 typedef void (*PP_CompletionCallback_Func)(void* user_data, int32_t result);
35 /** 36 /**
36 * @} 37 * @}
37 */ 38 */
38 39
39 /** 40 /**
40 *
41 * @addtogroup Enums 41 * @addtogroup Enums
42 * @{ 42 * @{
43 */ 43 */
44
45 /** 44 /**
46 * This enumeration contains flags used to control how non-NULL callbacks are 45 * This enumeration contains flags used to control how non-NULL callbacks are
47 * scheduled by asynchronous methods. 46 * scheduled by asynchronous methods.
48 */ 47 */
49 typedef enum { 48 typedef enum {
50 /** 49 /**
51 * This flag allows any non-NULL callback to be always invoked asynchronously, 50 * This flag allows any non-NULL callback to be always invoked asynchronously,
52 * on success or error, even if the operation could complete synchronously 51 * on success or error, even if the operation could complete synchronously
53 * without blocking. 52 * without blocking.
54 * 53 *
(...skipping 10 matching lines...) Expand all
65 * limited to the processing speed of the message loop. 64 * limited to the processing speed of the message loop.
66 * 65 *
67 * On synchronous method completion, the completion result will be returned 66 * On synchronous method completion, the completion result will be returned
68 * by the method itself. Otherwise, the method will return 67 * by the method itself. Otherwise, the method will return
69 * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on 68 * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on
70 * the main thread of PPAPI execution. 69 * the main thread of PPAPI execution.
71 */ 70 */
72 PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0 71 PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0
73 } PP_CompletionCallback_Flag; 72 } PP_CompletionCallback_Flag;
74 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Flag, 4); 73 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Flag, 4);
75
76 /** 74 /**
77 * @} 75 * @}
78 */ 76 */
79 77
80 /** 78 /**
81 * @addtogroup Structs 79 * @addtogroup Structs
82 * @{ 80 * @{
83 */ 81 */
84
85 /** 82 /**
86 * Any method that takes a PP_CompletionCallback can complete asynchronously. 83 * Any method that takes a PP_CompletionCallback can complete asynchronously.
87 * Refer to PP_CompletionCallback_Flag for more information. 84 * Refer to PP_CompletionCallback_Flag for more information.
88 * 85 *
89 * If PP_CompletionCallback_Func is NULL, the operation might block if necessary 86 * If PP_CompletionCallback_Func is NULL, the operation might block if necessary
90 * to complete the work. Refer to PP_BlockUntilComplete for more information. 87 * to complete the work. Refer to PP_BlockUntilComplete for more information.
91 * 88 *
92 * See PP_MakeCompletionCallback() for the description of each field. 89 * See PP_MakeCompletionCallback() for the description of each field.
93 */ 90 */
94 struct PP_CompletionCallback { 91 struct PP_CompletionCallback {
95 PP_CompletionCallback_Func func; 92 PP_CompletionCallback_Func func;
96 void* user_data; 93 void* user_data;
97 int32_t flags; 94 int32_t flags;
98 }; 95 };
99 /** 96 /**
100 * @} 97 * @}
101 */ 98 */
102 99
100 #include <stdlib.h>
101
103 /** 102 /**
104 * @addtogroup Functions 103 * @addtogroup Functions
105 * @{ 104 * @{
106 */ 105 */
107 /** 106 /**
108 * PP_MakeCompletionCallback() is used to create a PP_CompletionCallback 107 * PP_MakeCompletionCallback() is used to create a PP_CompletionCallback
109 * without flags. If you want to alter the default callback behavior, set the 108 * without flags. If you want to alter the default callback behavior, set the
110 * flags to a bit field combination of PP_CompletionCallback_Flag's. 109 * flags to a bit field combination of PP_CompletionCallback_Flag's.
111 * 110 *
112 * Example: 111 * Example:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 int32_t res) { 211 int32_t res) {
213 struct PP_CompletionCallback temp = *cc; 212 struct PP_CompletionCallback temp = *cc;
214 *cc = PP_BlockUntilComplete(); 213 *cc = PP_BlockUntilComplete();
215 PP_RunCompletionCallback(&temp, res); 214 PP_RunCompletionCallback(&temp, res);
216 } 215 }
217 /** 216 /**
218 * @} 217 * @}
219 */ 218 */
220 219
221 #endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */ 220 #endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */
221
OLDNEW
« no previous file with comments | « ppapi/c/pp_bool.h ('k') | ppapi/c/pp_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698