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

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

Issue 27730003: Avoid memory allocation for PPB_FileIO Read when callback is blocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address David's second round of comments. Created 7 years, 1 month 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/api/ppb_file_io.idl ('k') | ppapi/c/ppb_file_io.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 pp_array_output.idl modified Thu Mar 28 11:07:53 2013. */ 6 /* From pp_array_output.idl modified Tue Oct 22 15:09:25 2013. */
7 7
8 #ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_ 8 #ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_
9 #define PPAPI_C_PP_ARRAY_OUTPUT_H_ 9 #define PPAPI_C_PP_ARRAY_OUTPUT_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 * PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin 16 * PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin
(...skipping 19 matching lines...) Expand all
36 * @param user_data The pointer provided in the PP_ArrayOutput structure. This 36 * @param user_data The pointer provided in the PP_ArrayOutput structure. This
37 * has no meaning to the browser, it is intended to be used by the 37 * has no meaning to the browser, it is intended to be used by the
38 * implementation to figure out where to put the data. 38 * implementation to figure out where to put the data.
39 * 39 *
40 * @param element_count The number of elements in the array. This will be 0 40 * @param element_count The number of elements in the array. This will be 0
41 * if there is no data to return. 41 * if there is no data to return.
42 * 42 *
43 * @param element_size The size of each element in bytes. 43 * @param element_size The size of each element in bytes.
44 * 44 *
45 * @return Returns a pointer to the allocated memory. On failure, returns null. 45 * @return Returns a pointer to the allocated memory. On failure, returns null.
46 * You can also return null if the element_count is 0. 46 * You can also return null if the element_count is 0. When a non-null value is
47 * returned, the buffer must remain valid until after the callback runs. If used
48 * with a blocking callback, the buffer must remain valid until after the
49 * function returns. The plugin can then free any memory that it allocated.
47 */ 50 */
48 51
49 52
50 /** 53 /**
51 * @addtogroup Typedefs 54 * @addtogroup Typedefs
52 * @{ 55 * @{
53 */ 56 */
54 typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data, 57 typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data,
55 uint32_t element_count, 58 uint32_t element_count,
56 uint32_t element_size); 59 uint32_t element_size);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * } 95 * }
93 * void MyFunction() { 96 * void MyFunction() {
94 * MyArrayOutput array = { NULL, 0 }; 97 * MyArrayOutput array = { NULL, 0 };
95 * PP_ArrayOutput output = { &MyGetDataBuffer, &array }; 98 * PP_ArrayOutput output = { &MyGetDataBuffer, &array };
96 * ppb_foo->GetData(&output); 99 * ppb_foo->GetData(&output);
97 * } 100 * }
98 * @endcode 101 * @endcode
99 */ 102 */
100 struct PP_ArrayOutput { 103 struct PP_ArrayOutput {
101 /** 104 /**
102 * A pointer to the allocation function that the browser implements. 105 * A pointer to the allocation function that the browser will call.
103 */ 106 */
104 PP_ArrayOutput_GetDataBuffer GetDataBuffer; 107 PP_ArrayOutput_GetDataBuffer GetDataBuffer;
105 /** 108 /**
106 * Data that is passed to the allocation function. Typically, this is used 109 * Data that is passed to the allocation function. Typically, this is used
107 * to communicate how the data should be stored. 110 * to communicate how the data should be stored.
108 */ 111 */
109 void* user_data; 112 void* user_data;
110 }; 113 };
111 /** 114 /**
112 * @} 115 * @}
113 */ 116 */
114 117
115 #endif /* PPAPI_C_PP_ARRAY_OUTPUT_H_ */ 118 #endif /* PPAPI_C_PP_ARRAY_OUTPUT_H_ */
116 119
OLDNEW
« no previous file with comments | « ppapi/api/ppb_file_io.idl ('k') | ppapi/c/ppb_file_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698