OLD | NEW |
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 | 5 |
6 /* From ppb_file_io.idl modified Mon Aug 29 10:11:34 2011. */ | 6 /* From ppb_file_io.idl modified Tue Nov 29 11:02:24 2011. */ |
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_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
13 #include "ppapi/c/pp_file_info.h" | 13 #include "ppapi/c/pp_file_info.h" |
14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/c/pp_macros.h" | 15 #include "ppapi/c/pp_macros.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 110 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
111 * completion of Open(). | 111 * completion of Open(). |
112 * | 112 * |
113 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 113 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
114 */ | 114 */ |
115 int32_t (*Open)(PP_Resource file_io, | 115 int32_t (*Open)(PP_Resource file_io, |
116 PP_Resource file_ref, | 116 PP_Resource file_ref, |
117 int32_t open_flags, | 117 int32_t open_flags, |
118 struct PP_CompletionCallback callback); | 118 struct PP_CompletionCallback callback); |
119 /** | 119 /** |
120 * Query() queries info about the file opened by this FileIO object. This | 120 * Query() queries info about the file opened by this FileIO object. The |
121 * function will fail if the FileIO object has not been opened. | 121 * FileIO object must be opened, and there must be no other operations |
| 122 * pending. |
122 * | 123 * |
123 * @param[in] file_io A <code>PP_Resource</code> corresponding to a | 124 * @param[in] file_io A <code>PP_Resource</code> corresponding to a |
124 * FileIO. | 125 * FileIO. |
125 * @param[out] info The <code>PP_FileInfo</code> structure representing all | 126 * @param[out] info The <code>PP_FileInfo</code> structure representing all |
126 * information about the file. | 127 * information about the file. |
127 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 128 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
128 * completion of Query(). | 129 * completion of Query(). |
129 * | 130 * |
130 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 131 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 132 * PP_ERROR_FAILED will be returned if the file isn't opened, and |
| 133 * PP_ERROR_INPROGRESS will be returned if there is another operation pending. |
131 */ | 134 */ |
132 int32_t (*Query)(PP_Resource file_io, | 135 int32_t (*Query)(PP_Resource file_io, |
133 struct PP_FileInfo* info, | 136 struct PP_FileInfo* info, |
134 struct PP_CompletionCallback callback); | 137 struct PP_CompletionCallback callback); |
135 /** | 138 /** |
136 * Touch() Updates time stamps for the file opened by this FileIO object. | 139 * Touch() Updates time stamps for the file opened by this FileIO object. |
137 * This function will fail if the FileIO object has not been opened. | 140 * This function will fail if the FileIO object has not been opened. |
138 * | 141 * |
139 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 142 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
140 * FileIO. | 143 * FileIO. |
(...skipping 18 matching lines...) Expand all Loading... |
159 * @param[in] offset The offset into the file. | 162 * @param[in] offset The offset into the file. |
160 * @param[in] buffer The buffer to hold the specified number of bytes read. | 163 * @param[in] buffer The buffer to hold the specified number of bytes read. |
161 * @param[in] bytes_to_read The number of bytes to read from | 164 * @param[in] bytes_to_read The number of bytes to read from |
162 * <code>offset</code>. | 165 * <code>offset</code>. |
163 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 166 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
164 * completion of Read(). | 167 * completion of Read(). |
165 * | 168 * |
166 * @return An The number of bytes read an error code from | 169 * @return An The number of bytes read an error code from |
167 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 170 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
168 * reached. It is valid to call Read() multiple times with a completion | 171 * reached. It is valid to call Read() multiple times with a completion |
169 * callback to queue up parallel reads from the file at different offsets. | 172 * callback to queue up parallel reads from the file at different offsets, |
| 173 * but pending reads can not be interleaved with other operations. |
170 */ | 174 */ |
171 int32_t (*Read)(PP_Resource file_io, | 175 int32_t (*Read)(PP_Resource file_io, |
172 int64_t offset, | 176 int64_t offset, |
173 char* buffer, | 177 char* buffer, |
174 int32_t bytes_to_read, | 178 int32_t bytes_to_read, |
175 struct PP_CompletionCallback callback); | 179 struct PP_CompletionCallback callback); |
176 /** | 180 /** |
177 * Write() writes to an offset in the file. This function might perform a | 181 * Write() writes to an offset in the file. This function might perform a |
178 * partial write. The FileIO object must have been opened with write access. | 182 * partial write. The FileIO object must have been opened with write access. |
179 * | 183 * |
180 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 184 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
181 * FileIO. | 185 * FileIO. |
182 * @param[in] offset The offset into the file. | 186 * @param[in] offset The offset into the file. |
183 * @param[in] buffer The buffer to hold the specified number of bytes read. | 187 * @param[in] buffer The buffer to hold the specified number of bytes read. |
184 * @param[in] bytes_to_write The number of bytes to write to | 188 * @param[in] bytes_to_write The number of bytes to write to |
185 * <code>offset</code>. | 189 * <code>offset</code>. |
186 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 190 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
187 * completion of Write(). | 191 * completion of Write(). |
188 * | 192 * |
189 * @return An The number of bytes written or an error code from | 193 * @return An The number of bytes written or an error code from |
190 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was | 194 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was |
191 * reached. It is valid to call Write() multiple times with a completion | 195 * reached. It is valid to call Write() multiple times with a completion |
192 * callback to queue up parallel writes to the file at different offsets. | 196 * callback to queue up parallel writes to the file at different offsets, but |
| 197 * pending writes can not be interleaved with other operations. |
193 */ | 198 */ |
194 int32_t (*Write)(PP_Resource file_io, | 199 int32_t (*Write)(PP_Resource file_io, |
195 int64_t offset, | 200 int64_t offset, |
196 const char* buffer, | 201 const char* buffer, |
197 int32_t bytes_to_write, | 202 int32_t bytes_to_write, |
198 struct PP_CompletionCallback callback); | 203 struct PP_CompletionCallback callback); |
199 /** | 204 /** |
200 * SetLength() sets the length of the file. If the file size is extended, | 205 * SetLength() sets the length of the file. If the file size is extended, |
201 * then the extended area of the file is zero-filled. The FileIO object must | 206 * then the extended area of the file is zero-filled. The FileIO object must |
202 * have been opened with write access. | 207 * have been opened with write access. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 * FileIO. | 241 * FileIO. |
237 */ | 242 */ |
238 void (*Close)(PP_Resource file_io); | 243 void (*Close)(PP_Resource file_io); |
239 }; | 244 }; |
240 /** | 245 /** |
241 * @} | 246 * @} |
242 */ | 247 */ |
243 | 248 |
244 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ | 249 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ |
245 | 250 |
OLD | NEW |