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

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

Issue 8764003: Implement a proxy for Pepper FileIO. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Homestarmy Created 9 years 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/ppapi_proxy.gypi » ('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) 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 Thu Dec 1 10:47:02 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
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. The
141 * FileIO object must be opened, and there must be no other operations
142 * pending.
138 * 143 *
139 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 144 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
140 * FileIO. 145 * FileIO.
141 * @param[in] last_access_time The last time the FileIO was accessed. 146 * @param[in] last_access_time The last time the FileIO was accessed.
142 * @param[in] last_modified_time The last time the FileIO was modified. 147 * @param[in] last_modified_time The last time the FileIO was modified.
143 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 148 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
144 * completion of Touch(). 149 * completion of Touch().
145 * 150 *
146 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 151 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
152 * PP_ERROR_FAILED will be returned if the file isn't opened, and
153 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
147 */ 154 */
148 int32_t (*Touch)(PP_Resource file_io, 155 int32_t (*Touch)(PP_Resource file_io,
149 PP_Time last_access_time, 156 PP_Time last_access_time,
150 PP_Time last_modified_time, 157 PP_Time last_modified_time,
151 struct PP_CompletionCallback callback); 158 struct PP_CompletionCallback callback);
152 /** 159 /**
153 * Read() reads from an offset in the file. The size of the buffer must be 160 * Read() reads from an offset in the file. The size of the buffer must be
154 * large enough to hold the specified number of bytes to read. This function 161 * large enough to hold the specified number of bytes to read. This function
155 * might perform a partial read. 162 * might perform a partial read.
156 * 163 *
157 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 164 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
158 * FileIO. 165 * FileIO.
159 * @param[in] offset The offset into the file. 166 * @param[in] offset The offset into the file.
160 * @param[in] buffer The buffer to hold the specified number of bytes read. 167 * @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 168 * @param[in] bytes_to_read The number of bytes to read from
162 * <code>offset</code>. 169 * <code>offset</code>.
163 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 170 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
164 * completion of Read(). 171 * completion of Read().
165 * 172 *
166 * @return An The number of bytes read an error code from 173 * @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 174 * <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 175 * 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. 176 * callback to queue up parallel reads from the file, but pending reads
177 * cannot be interleaved with other operations.
170 */ 178 */
171 int32_t (*Read)(PP_Resource file_io, 179 int32_t (*Read)(PP_Resource file_io,
172 int64_t offset, 180 int64_t offset,
173 char* buffer, 181 char* buffer,
174 int32_t bytes_to_read, 182 int32_t bytes_to_read,
175 struct PP_CompletionCallback callback); 183 struct PP_CompletionCallback callback);
176 /** 184 /**
177 * Write() writes to an offset in the file. This function might perform a 185 * 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. 186 * partial write. The FileIO object must have been opened with write access.
179 * 187 *
180 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 188 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
181 * FileIO. 189 * FileIO.
182 * @param[in] offset The offset into the file. 190 * @param[in] offset The offset into the file.
183 * @param[in] buffer The buffer to hold the specified number of bytes read. 191 * @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 192 * @param[in] bytes_to_write The number of bytes to write to
185 * <code>offset</code>. 193 * <code>offset</code>.
186 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 194 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
187 * completion of Write(). 195 * completion of Write().
188 * 196 *
189 * @return An The number of bytes written or an error code from 197 * @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 198 * <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 199 * 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. 200 * callback to queue up parallel writes to the file, but pending writes
201 * cannot be interleaved with other operations.
193 */ 202 */
194 int32_t (*Write)(PP_Resource file_io, 203 int32_t (*Write)(PP_Resource file_io,
195 int64_t offset, 204 int64_t offset,
196 const char* buffer, 205 const char* buffer,
197 int32_t bytes_to_write, 206 int32_t bytes_to_write,
198 struct PP_CompletionCallback callback); 207 struct PP_CompletionCallback callback);
199 /** 208 /**
200 * SetLength() sets the length of the file. If the file size is extended, 209 * 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 210 * then the extended area of the file is zero-filled. The FileIO object must
202 * have been opened with write access. 211 * have been opened with write access and there must be no other operations
212 * pending.
203 * 213 *
204 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 214 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
205 * FileIO. 215 * FileIO.
206 * @param[in] length The length of the file to be set. 216 * @param[in] length The length of the file to be set.
207 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 217 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
208 * completion of SetLength(). 218 * completion of SetLength().
209 * 219 *
210 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 220 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
221 * PP_ERROR_FAILED will be returned if the file isn't opened, and
222 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
211 */ 223 */
212 int32_t (*SetLength)(PP_Resource file_io, 224 int32_t (*SetLength)(PP_Resource file_io,
213 int64_t length, 225 int64_t length,
214 struct PP_CompletionCallback callback); 226 struct PP_CompletionCallback callback);
215 /** 227 /**
216 * Flush() flushes changes to disk. This call can be very expensive! 228 * Flush() flushes changes to disk. This call can be very expensive! The
229 * FileIO object must have been opened with write access and there must be no
230 * other operations pending.
217 * 231 *
218 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 232 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
219 * FileIO. 233 * FileIO.
220 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 234 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
221 * completion of Flush(). 235 * completion of Flush().
222 * 236 *
223 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 237 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
238 * PP_ERROR_FAILED will be returned if the file isn't opened, and
239 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
224 */ 240 */
225 int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); 241 int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback);
226 /** 242 /**
227 * Close() cancels any IO that may be pending, and closes the FileIO object. 243 * Close() cancels any IO that may be pending, and closes the FileIO object.
228 * Any pending callbacks will still run, reporting 244 * Any pending callbacks will still run, reporting
229 * <code>PP_Error_Aborted</code> if pending IO was interrupted. It is not 245 * <code>PP_Error_Aborted</code> if pending IO was interrupted. It is not
230 * valid to call Open() again after a call to this method. 246 * valid to call Open() again after a call to this method.
231 * <strong>Note:</strong> If the FileIO object is destroyed, and it is still 247 * <strong>Note:</strong> If the FileIO object is destroyed, and it is still
232 * open, then it will be implicitly closed, so you are not required to call 248 * open, then it will be implicitly closed, so you are not required to call
233 * Close(). 249 * Close().
234 * 250 *
235 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 251 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
236 * FileIO. 252 * FileIO.
237 */ 253 */
238 void (*Close)(PP_Resource file_io); 254 void (*Close)(PP_Resource file_io);
239 }; 255 };
240 /** 256 /**
241 * @} 257 * @}
242 */ 258 */
243 259
244 #endif /* PPAPI_C_PPB_FILE_IO_H_ */ 260 #endif /* PPAPI_C_PPB_FILE_IO_H_ */
245 261
OLDNEW
« no previous file with comments | « ppapi/api/ppb_file_io.idl ('k') | ppapi/ppapi_proxy.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698