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 | 6 |
7 /** | 7 /** |
8 * This file defines the API to create a file i/o object. | 8 * This file defines the API to create a file i/o object. |
9 */ | 9 */ |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 /** | 114 /** |
115 * Query() queries info about the file opened by this FileIO object. The | 115 * Query() queries info about the file opened by this FileIO object. The |
116 * FileIO object must be opened, and there must be no other operations | 116 * FileIO object must be opened, and there must be no other operations |
117 * pending. | 117 * pending. |
118 * | 118 * |
119 * @param[in] file_io A <code>PP_Resource</code> corresponding to a | 119 * @param[in] file_io A <code>PP_Resource</code> corresponding to a |
120 * FileIO. | 120 * FileIO. |
121 * @param[out] info The <code>PP_FileInfo</code> structure representing all | 121 * @param[out] info The <code>PP_FileInfo</code> structure representing all |
122 * information about the file. | 122 * information about the file. |
123 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 123 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
124 * completion of Query(). | 124 * completion of Query(). <code>info</code> must remain valid until after the |
| 125 * callback runs. If you pass a blocking callback, <code>info</code> must |
| 126 * remain valid until after Query() returns. |
125 * | 127 * |
126 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 128 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
127 * PP_ERROR_FAILED will be returned if the file isn't opened, and | 129 * PP_ERROR_FAILED will be returned if the file isn't opened, and |
128 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. | 130 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. |
129 */ | 131 */ |
130 int32_t Query([in] PP_Resource file_io, | 132 int32_t Query([in] PP_Resource file_io, |
131 [out] PP_FileInfo info, | 133 [out] PP_FileInfo info, |
132 [in] PP_CompletionCallback callback); | 134 [in] PP_CompletionCallback callback); |
133 | 135 |
134 /** | 136 /** |
(...skipping 16 matching lines...) Expand all Loading... |
151 int32_t Touch([in] PP_Resource file_io, | 153 int32_t Touch([in] PP_Resource file_io, |
152 [in] PP_Time last_access_time, | 154 [in] PP_Time last_access_time, |
153 [in] PP_Time last_modified_time, | 155 [in] PP_Time last_modified_time, |
154 [in] PP_CompletionCallback callback); | 156 [in] PP_CompletionCallback callback); |
155 | 157 |
156 /** | 158 /** |
157 * Read() reads from an offset in the file. The size of the buffer must be | 159 * Read() reads from an offset in the file. The size of the buffer must be |
158 * large enough to hold the specified number of bytes to read. This function | 160 * large enough to hold the specified number of bytes to read. This function |
159 * might perform a partial read, meaning all the requested bytes | 161 * might perform a partial read, meaning all the requested bytes |
160 * might not be returned, even if the end of the file has not been reached. | 162 * might not be returned, even if the end of the file has not been reached. |
| 163 * The FileIO object must have been opened with read access. |
161 * | 164 * |
162 * ReadToArray() is preferred to Read() when doing asynchronous operations. | 165 * ReadToArray() is preferred to Read() when doing asynchronous operations. |
163 * | 166 * |
164 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 167 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
165 * FileIO. | 168 * FileIO. |
166 * @param[in] offset The offset into the file. | 169 * @param[in] offset The offset into the file. |
167 * @param[in] buffer The buffer to hold the specified number of bytes read. | 170 * @param[in] buffer The buffer to hold the specified number of bytes read. |
168 * @param[in] bytes_to_read The number of bytes to read from | 171 * @param[in] bytes_to_read The number of bytes to read from |
169 * <code>offset</code>. | 172 * <code>offset</code>. |
170 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 173 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
171 * completion of Read(). | 174 * completion of Read(). <code>buffer</code> must remain valid until after |
| 175 * the callback runs. If you pass a blocking callback, <code>buffer</code> |
| 176 * must remain valid until after Read() returns. |
172 * | 177 * |
173 * @return The number of bytes read or an error code from | 178 * @return The number of bytes read or an error code from |
174 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 179 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
175 * reached. It is valid to call Read() multiple times with a completion | 180 * reached. It is valid to call Read() multiple times with a completion |
176 * callback to queue up parallel reads from the file, but pending reads | 181 * callback to queue up parallel reads from the file, but pending reads |
177 * cannot be interleaved with other operations. | 182 * cannot be interleaved with other operations. |
178 */ | 183 */ |
179 int32_t Read([in] PP_Resource file_io, | 184 int32_t Read([in] PP_Resource file_io, |
180 [in] int64_t offset, | 185 [in] int64_t offset, |
181 [inout] str_t buffer, | 186 [inout] str_t buffer, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 * Close(). | 258 * Close(). |
254 * | 259 * |
255 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 260 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
256 * FileIO. | 261 * FileIO. |
257 */ | 262 */ |
258 void Close([in] PP_Resource file_io); | 263 void Close([in] PP_Resource file_io); |
259 | 264 |
260 /** | 265 /** |
261 * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be | 266 * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be |
262 * provided so that output will be stored in its allocated buffer. This | 267 * provided so that output will be stored in its allocated buffer. This |
263 * function might perform a partial read. | 268 * function might perform a partial read. The FileIO object must have been |
| 269 * opened with read access. |
264 * | 270 * |
265 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 271 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
266 * FileIO. | 272 * FileIO. |
267 * @param[in] offset The offset into the file. | 273 * @param[in] offset The offset into the file. |
268 * @param[in] max_read_length The maximum number of bytes to read from | 274 * @param[in] max_read_length The maximum number of bytes to read from |
269 * <code>offset</code>. | 275 * <code>offset</code>. |
270 * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. | 276 * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. |
271 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 277 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
272 * completion of ReadToArray(). | 278 * completion of ReadToArray(). |
273 * | 279 * |
274 * @return The number of bytes read or an error code from | 280 * @return The number of bytes read or an error code from |
275 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 281 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
276 * reached. It is valid to call ReadToArray() multiple times with a completion | 282 * reached. It is valid to call ReadToArray() multiple times with a completion |
277 * callback to queue up parallel reads from the file, but pending reads | 283 * callback to queue up parallel reads from the file, but pending reads |
278 * cannot be interleaved with other operations. | 284 * cannot be interleaved with other operations. |
279 */ | 285 */ |
280 [version = 1.1] | 286 [version = 1.1] |
281 int32_t ReadToArray([in] PP_Resource file_io, | 287 int32_t ReadToArray([in] PP_Resource file_io, |
282 [in] int64_t offset, | 288 [in] int64_t offset, |
283 [in] int32_t max_read_length, | 289 [in] int32_t max_read_length, |
284 [inout] PP_ArrayOutput output, | 290 [inout] PP_ArrayOutput output, |
285 [in] PP_CompletionCallback callback); | 291 [in] PP_CompletionCallback callback); |
286 }; | 292 }; |
287 | 293 |
OLD | NEW |