Chromium Code Reviews| 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(). If <code>callback</code> is blocking, then |
| 125 * <code>info</code> must remain valid until after the callback runs. | |
|
dmichael (off chromium)
2013/10/22 21:07:51
This is true not just for blocking callbacks... a
bbudge
2013/10/22 22:13:34
Done.
| |
| 125 * | 126 * |
| 126 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 127 * @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 | 128 * 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. | 129 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. |
| 129 */ | 130 */ |
| 130 int32_t Query([in] PP_Resource file_io, | 131 int32_t Query([in] PP_Resource file_io, |
| 131 [out] PP_FileInfo info, | 132 [out] PP_FileInfo info, |
| 132 [in] PP_CompletionCallback callback); | 133 [in] PP_CompletionCallback callback); |
| 133 | 134 |
| 134 /** | 135 /** |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 151 int32_t Touch([in] PP_Resource file_io, | 152 int32_t Touch([in] PP_Resource file_io, |
| 152 [in] PP_Time last_access_time, | 153 [in] PP_Time last_access_time, |
| 153 [in] PP_Time last_modified_time, | 154 [in] PP_Time last_modified_time, |
| 154 [in] PP_CompletionCallback callback); | 155 [in] PP_CompletionCallback callback); |
| 155 | 156 |
| 156 /** | 157 /** |
| 157 * Read() reads from an offset in the file. The size of the buffer must be | 158 * 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 | 159 * large enough to hold the specified number of bytes to read. This function |
| 159 * might perform a partial read, meaning all the requested bytes | 160 * 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. | 161 * might not be returned, even if the end of the file has not been reached. |
| 162 * The FileIO object must have been opened with read access. | |
| 161 * | 163 * |
| 162 * ReadToArray() is preferred to Read() when doing asynchronous operations. | 164 * ReadToArray() is preferred to Read() when doing asynchronous operations. |
| 163 * | 165 * |
| 164 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 166 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
| 165 * FileIO. | 167 * FileIO. |
| 166 * @param[in] offset The offset into the file. | 168 * @param[in] offset The offset into the file. |
| 167 * @param[in] buffer The buffer to hold the specified number of bytes read. | 169 * @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 | 170 * @param[in] bytes_to_read The number of bytes to read from |
| 169 * <code>offset</code>. | 171 * <code>offset</code>. |
| 170 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 172 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 171 * completion of Read(). | 173 * completion of Read(). If <code>callback</code> is blocking, then |
| 174 * <code>buffer</code> must remain valid until after the callback runs. | |
| 172 * | 175 * |
| 173 * @return The number of bytes read or an error code from | 176 * @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 | 177 * <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 | 178 * 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 | 179 * callback to queue up parallel reads from the file, but pending reads |
| 177 * cannot be interleaved with other operations. | 180 * cannot be interleaved with other operations. |
| 178 */ | 181 */ |
| 179 int32_t Read([in] PP_Resource file_io, | 182 int32_t Read([in] PP_Resource file_io, |
| 180 [in] int64_t offset, | 183 [in] int64_t offset, |
| 181 [inout] str_t buffer, | 184 [inout] str_t buffer, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 * Close(). | 256 * Close(). |
| 254 * | 257 * |
| 255 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 258 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
| 256 * FileIO. | 259 * FileIO. |
| 257 */ | 260 */ |
| 258 void Close([in] PP_Resource file_io); | 261 void Close([in] PP_Resource file_io); |
| 259 | 262 |
| 260 /** | 263 /** |
| 261 * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be | 264 * 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 | 265 * provided so that output will be stored in its allocated buffer. This |
| 263 * function might perform a partial read. | 266 * function might perform a partial read. The FileIO object must have been |
| 267 * opened with read access. | |
| 264 * | 268 * |
| 265 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 269 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
| 266 * FileIO. | 270 * FileIO. |
| 267 * @param[in] offset The offset into the file. | 271 * @param[in] offset The offset into the file. |
| 268 * @param[in] max_read_length The maximum number of bytes to read from | 272 * @param[in] max_read_length The maximum number of bytes to read from |
| 269 * <code>offset</code>. | 273 * <code>offset</code>. |
| 270 * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. | 274 * @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 | 275 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 272 * completion of ReadToArray(). | 276 * completion of ReadToArray(). |
| 273 * | 277 * |
| 274 * @return The number of bytes read or an error code from | 278 * @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 | 279 * <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 | 280 * 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 | 281 * callback to queue up parallel reads from the file, but pending reads |
| 278 * cannot be interleaved with other operations. | 282 * cannot be interleaved with other operations. |
| 279 */ | 283 */ |
| 280 [version = 1.1] | 284 [version = 1.1] |
| 281 int32_t ReadToArray([in] PP_Resource file_io, | 285 int32_t ReadToArray([in] PP_Resource file_io, |
| 282 [in] int64_t offset, | 286 [in] int64_t offset, |
| 283 [in] int32_t max_read_length, | 287 [in] int32_t max_read_length, |
| 284 [inout] PP_ArrayOutput output, | 288 [inout] PP_ArrayOutput output, |
| 285 [in] PP_CompletionCallback callback); | 289 [in] PP_CompletionCallback callback); |
| 286 }; | 290 }; |
| 287 | 291 |
| OLD | NEW |