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 ppb_file_io.idl modified Tue Jun 11 15:21:38 2013. */ | 6 /* From ppb_file_io.idl modified Tue Oct 22 15:09:47 2013. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_FILE_IO_H_ | 8 #ifndef PPAPI_C_PPB_FILE_IO_H_ |
9 #define PPAPI_C_PPB_FILE_IO_H_ | 9 #define PPAPI_C_PPB_FILE_IO_H_ |
10 | 10 |
11 #include "ppapi/c/pp_array_output.h" | 11 #include "ppapi/c/pp_array_output.h" |
12 #include "ppapi/c/pp_bool.h" | 12 #include "ppapi/c/pp_bool.h" |
13 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_file_info.h" | 14 #include "ppapi/c/pp_file_info.h" |
15 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
16 #include "ppapi/c/pp_macros.h" | 16 #include "ppapi/c/pp_macros.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 /** | 128 /** |
129 * Query() queries info about the file opened by this FileIO object. The | 129 * Query() queries info about the file opened by this FileIO object. The |
130 * FileIO object must be opened, and there must be no other operations | 130 * FileIO object must be opened, and there must be no other operations |
131 * pending. | 131 * pending. |
132 * | 132 * |
133 * @param[in] file_io A <code>PP_Resource</code> corresponding to a | 133 * @param[in] file_io A <code>PP_Resource</code> corresponding to a |
134 * FileIO. | 134 * FileIO. |
135 * @param[out] info The <code>PP_FileInfo</code> structure representing all | 135 * @param[out] info The <code>PP_FileInfo</code> structure representing all |
136 * information about the file. | 136 * information about the file. |
137 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 137 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
138 * completion of Query(). | 138 * completion of Query(). <code>info</code> must remain valid until after the |
| 139 * callback runs. If you pass a blocking callback, <code>info</code> must |
| 140 * remain valid until after Query() returns. |
139 * | 141 * |
140 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 142 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
141 * PP_ERROR_FAILED will be returned if the file isn't opened, and | 143 * PP_ERROR_FAILED will be returned if the file isn't opened, and |
142 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. | 144 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. |
143 */ | 145 */ |
144 int32_t (*Query)(PP_Resource file_io, | 146 int32_t (*Query)(PP_Resource file_io, |
145 struct PP_FileInfo* info, | 147 struct PP_FileInfo* info, |
146 struct PP_CompletionCallback callback); | 148 struct PP_CompletionCallback callback); |
147 /** | 149 /** |
148 * Touch() Updates time stamps for the file opened by this FileIO object. | 150 * Touch() Updates time stamps for the file opened by this FileIO object. |
(...skipping 14 matching lines...) Expand all Loading... |
163 */ | 165 */ |
164 int32_t (*Touch)(PP_Resource file_io, | 166 int32_t (*Touch)(PP_Resource file_io, |
165 PP_Time last_access_time, | 167 PP_Time last_access_time, |
166 PP_Time last_modified_time, | 168 PP_Time last_modified_time, |
167 struct PP_CompletionCallback callback); | 169 struct PP_CompletionCallback callback); |
168 /** | 170 /** |
169 * Read() reads from an offset in the file. The size of the buffer must be | 171 * Read() reads from an offset in the file. The size of the buffer must be |
170 * large enough to hold the specified number of bytes to read. This function | 172 * large enough to hold the specified number of bytes to read. This function |
171 * might perform a partial read, meaning all the requested bytes | 173 * might perform a partial read, meaning all the requested bytes |
172 * might not be returned, even if the end of the file has not been reached. | 174 * might not be returned, even if the end of the file has not been reached. |
| 175 * The FileIO object must have been opened with read access. |
173 * | 176 * |
174 * ReadToArray() is preferred to Read() when doing asynchronous operations. | 177 * ReadToArray() is preferred to Read() when doing asynchronous operations. |
175 * | 178 * |
176 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 179 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
177 * FileIO. | 180 * FileIO. |
178 * @param[in] offset The offset into the file. | 181 * @param[in] offset The offset into the file. |
179 * @param[in] buffer The buffer to hold the specified number of bytes read. | 182 * @param[in] buffer The buffer to hold the specified number of bytes read. |
180 * @param[in] bytes_to_read The number of bytes to read from | 183 * @param[in] bytes_to_read The number of bytes to read from |
181 * <code>offset</code>. | 184 * <code>offset</code>. |
182 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 185 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
183 * completion of Read(). | 186 * completion of Read(). <code>buffer</code> must remain valid until after |
| 187 * the callback runs. If you pass a blocking callback, <code>buffer</code> |
| 188 * must remain valid until after Read() returns. |
184 * | 189 * |
185 * @return The number of bytes read or an error code from | 190 * @return The number of bytes read or an error code from |
186 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 191 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
187 * reached. It is valid to call Read() multiple times with a completion | 192 * reached. It is valid to call Read() multiple times with a completion |
188 * callback to queue up parallel reads from the file, but pending reads | 193 * callback to queue up parallel reads from the file, but pending reads |
189 * cannot be interleaved with other operations. | 194 * cannot be interleaved with other operations. |
190 */ | 195 */ |
191 int32_t (*Read)(PP_Resource file_io, | 196 int32_t (*Read)(PP_Resource file_io, |
192 int64_t offset, | 197 int64_t offset, |
193 char* buffer, | 198 char* buffer, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 * open, then it will be implicitly closed, so you are not required to call | 265 * open, then it will be implicitly closed, so you are not required to call |
261 * Close(). | 266 * Close(). |
262 * | 267 * |
263 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 268 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
264 * FileIO. | 269 * FileIO. |
265 */ | 270 */ |
266 void (*Close)(PP_Resource file_io); | 271 void (*Close)(PP_Resource file_io); |
267 /** | 272 /** |
268 * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be | 273 * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be |
269 * provided so that output will be stored in its allocated buffer. This | 274 * provided so that output will be stored in its allocated buffer. This |
270 * function might perform a partial read. | 275 * function might perform a partial read. The FileIO object must have been |
| 276 * opened with read access. |
271 * | 277 * |
272 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 278 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
273 * FileIO. | 279 * FileIO. |
274 * @param[in] offset The offset into the file. | 280 * @param[in] offset The offset into the file. |
275 * @param[in] max_read_length The maximum number of bytes to read from | 281 * @param[in] max_read_length The maximum number of bytes to read from |
276 * <code>offset</code>. | 282 * <code>offset</code>. |
277 * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. | 283 * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. |
278 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 284 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
279 * completion of ReadToArray(). | 285 * completion of ReadToArray(). |
280 * | 286 * |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 struct PP_CompletionCallback callback); | 328 struct PP_CompletionCallback callback); |
323 int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); | 329 int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); |
324 void (*Close)(PP_Resource file_io); | 330 void (*Close)(PP_Resource file_io); |
325 }; | 331 }; |
326 /** | 332 /** |
327 * @} | 333 * @} |
328 */ | 334 */ |
329 | 335 |
330 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ | 336 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ |
331 | 337 |
OLD | NEW |