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

Side by Side Diff: ppapi/api/ppb_file_io.idl

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 | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/c/ppb_file_io.h » ('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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * completion of Open(). 92 * completion of Open().
93 * 93 *
94 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 94 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
95 */ 95 */
96 int32_t Open([in] PP_Resource file_io, 96 int32_t Open([in] PP_Resource file_io,
97 [in] PP_Resource file_ref, 97 [in] PP_Resource file_ref,
98 [in] int32_t open_flags, 98 [in] int32_t open_flags,
99 [in] PP_CompletionCallback callback); 99 [in] PP_CompletionCallback callback);
100 100
101 /** 101 /**
102 * Query() queries info about the file opened by this FileIO object. This 102 * Query() queries info about the file opened by this FileIO object. The
103 * function will fail if the FileIO object has not been opened. 103 * FileIO object must be opened, and there must be no other operations
104 * pending.
104 * 105 *
105 * @param[in] file_io A <code>PP_Resource</code> corresponding to a 106 * @param[in] file_io A <code>PP_Resource</code> corresponding to a
106 * FileIO. 107 * FileIO.
107 * @param[out] info The <code>PP_FileInfo</code> structure representing all 108 * @param[out] info The <code>PP_FileInfo</code> structure representing all
108 * information about the file. 109 * information about the file.
109 * @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
110 * completion of Query(). 111 * completion of Query().
111 * 112 *
112 * @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 * PP_ERROR_FAILED will be returned if the file isn't opened, and
115 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
113 */ 116 */
114 int32_t Query([in] PP_Resource file_io, 117 int32_t Query([in] PP_Resource file_io,
115 [out] PP_FileInfo info, 118 [out] PP_FileInfo info,
116 [in] PP_CompletionCallback callback); 119 [in] PP_CompletionCallback callback);
117 120
118 /** 121 /**
119 * Touch() Updates time stamps for the file opened by this FileIO object. 122 * Touch() Updates time stamps for the file opened by this FileIO object.
120 * This function will fail if the FileIO object has not been opened. 123 * This function will fail if the FileIO object has not been opened. The
124 * FileIO object must be opened, and there must be no other operations
125 * pending.
121 * 126 *
122 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 127 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
123 * FileIO. 128 * FileIO.
124 * @param[in] last_access_time The last time the FileIO was accessed. 129 * @param[in] last_access_time The last time the FileIO was accessed.
125 * @param[in] last_modified_time The last time the FileIO was modified. 130 * @param[in] last_modified_time The last time the FileIO was modified.
126 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 131 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
127 * completion of Touch(). 132 * completion of Touch().
128 * 133 *
129 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 134 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
135 * PP_ERROR_FAILED will be returned if the file isn't opened, and
136 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
130 */ 137 */
131 int32_t Touch([in] PP_Resource file_io, 138 int32_t Touch([in] PP_Resource file_io,
132 [in] PP_Time last_access_time, 139 [in] PP_Time last_access_time,
133 [in] PP_Time last_modified_time, 140 [in] PP_Time last_modified_time,
134 [in] PP_CompletionCallback callback); 141 [in] PP_CompletionCallback callback);
135 142
136 /** 143 /**
137 * Read() reads from an offset in the file. The size of the buffer must be 144 * Read() reads from an offset in the file. The size of the buffer must be
138 * large enough to hold the specified number of bytes to read. This function 145 * large enough to hold the specified number of bytes to read. This function
139 * might perform a partial read. 146 * might perform a partial read.
140 * 147 *
141 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 148 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
142 * FileIO. 149 * FileIO.
143 * @param[in] offset The offset into the file. 150 * @param[in] offset The offset into the file.
144 * @param[in] buffer The buffer to hold the specified number of bytes read. 151 * @param[in] buffer The buffer to hold the specified number of bytes read.
145 * @param[in] bytes_to_read The number of bytes to read from 152 * @param[in] bytes_to_read The number of bytes to read from
146 * <code>offset</code>. 153 * <code>offset</code>.
147 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 154 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
148 * completion of Read(). 155 * completion of Read().
149 * 156 *
150 * @return An The number of bytes read an error code from 157 * @return An The number of bytes read an error code from
151 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was 158 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
152 * reached. It is valid to call Read() multiple times with a completion 159 * reached. It is valid to call Read() multiple times with a completion
153 * callback to queue up parallel reads from the file at different offsets. 160 * callback to queue up parallel reads from the file, but pending reads
161 * cannot be interleaved with other operations.
154 */ 162 */
155 int32_t Read([in] PP_Resource file_io, 163 int32_t Read([in] PP_Resource file_io,
156 [in] int64_t offset, 164 [in] int64_t offset,
157 [inout] str_t buffer, 165 [inout] str_t buffer,
158 [in] int32_t bytes_to_read, 166 [in] int32_t bytes_to_read,
159 [in] PP_CompletionCallback callback); 167 [in] PP_CompletionCallback callback);
160 168
161 /** 169 /**
162 * Write() writes to an offset in the file. This function might perform a 170 * Write() writes to an offset in the file. This function might perform a
163 * partial write. The FileIO object must have been opened with write access. 171 * partial write. The FileIO object must have been opened with write access.
164 * 172 *
165 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 173 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
166 * FileIO. 174 * FileIO.
167 * @param[in] offset The offset into the file. 175 * @param[in] offset The offset into the file.
168 * @param[in] buffer The buffer to hold the specified number of bytes read. 176 * @param[in] buffer The buffer to hold the specified number of bytes read.
169 * @param[in] bytes_to_write The number of bytes to write to 177 * @param[in] bytes_to_write The number of bytes to write to
170 * <code>offset</code>. 178 * <code>offset</code>.
171 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 179 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
172 * completion of Write(). 180 * completion of Write().
173 * 181 *
174 * @return An The number of bytes written or an error code from 182 * @return An The number of bytes written or an error code from
175 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was 183 * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
176 * reached. It is valid to call Write() multiple times with a completion 184 * reached. It is valid to call Write() multiple times with a completion
177 * callback to queue up parallel writes to the file at different offsets. 185 * callback to queue up parallel writes to the file, but pending writes
186 * cannot be interleaved with other operations.
178 */ 187 */
179 int32_t Write([in] PP_Resource file_io, 188 int32_t Write([in] PP_Resource file_io,
180 [in] int64_t offset, 189 [in] int64_t offset,
181 [in] str_t buffer, 190 [in] str_t buffer,
182 [in] int32_t bytes_to_write, 191 [in] int32_t bytes_to_write,
183 [in] PP_CompletionCallback callback); 192 [in] PP_CompletionCallback callback);
184 /** 193 /**
185 * SetLength() sets the length of the file. If the file size is extended, 194 * SetLength() sets the length of the file. If the file size is extended,
186 * then the extended area of the file is zero-filled. The FileIO object must 195 * then the extended area of the file is zero-filled. The FileIO object must
187 * have been opened with write access. 196 * have been opened with write access and there must be no other operations
197 * pending.
188 * 198 *
189 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 199 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
190 * FileIO. 200 * FileIO.
191 * @param[in] length The length of the file to be set. 201 * @param[in] length The length of the file to be set.
192 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 202 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
193 * completion of SetLength(). 203 * completion of SetLength().
194 * 204 *
195 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 205 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
206 * PP_ERROR_FAILED will be returned if the file isn't opened, and
207 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
196 */ 208 */
197 int32_t SetLength([in] PP_Resource file_io, 209 int32_t SetLength([in] PP_Resource file_io,
198 [in] int64_t length, 210 [in] int64_t length,
199 [in] PP_CompletionCallback callback); 211 [in] PP_CompletionCallback callback);
200 212
201 /** 213 /**
202 * Flush() flushes changes to disk. This call can be very expensive! 214 * Flush() flushes changes to disk. This call can be very expensive! The
215 * FileIO object must have been opened with write access and there must be no
216 * other operations pending.
203 * 217 *
204 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 218 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
205 * FileIO. 219 * FileIO.
206 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 220 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
207 * completion of Flush(). 221 * completion of Flush().
208 * 222 *
209 * @return An int32_t containing an error code from <code>pp_errors.h</code>. 223 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
224 * PP_ERROR_FAILED will be returned if the file isn't opened, and
225 * PP_ERROR_INPROGRESS will be returned if there is another operation pending.
210 */ 226 */
211 int32_t Flush([in] PP_Resource file_io, 227 int32_t Flush([in] PP_Resource file_io,
212 [in] PP_CompletionCallback callback); 228 [in] PP_CompletionCallback callback);
213 229
214 /** 230 /**
215 * Close() cancels any IO that may be pending, and closes the FileIO object. 231 * Close() cancels any IO that may be pending, and closes the FileIO object.
216 * Any pending callbacks will still run, reporting 232 * Any pending callbacks will still run, reporting
217 * <code>PP_Error_Aborted</code> if pending IO was interrupted. It is not 233 * <code>PP_Error_Aborted</code> if pending IO was interrupted. It is not
218 * valid to call Open() again after a call to this method. 234 * valid to call Open() again after a call to this method.
219 * <strong>Note:</strong> If the FileIO object is destroyed, and it is still 235 * <strong>Note:</strong> If the FileIO object is destroyed, and it is still
220 * open, then it will be implicitly closed, so you are not required to call 236 * open, then it will be implicitly closed, so you are not required to call
221 * Close(). 237 * Close().
222 * 238 *
223 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file 239 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
224 * FileIO. 240 * FileIO.
225 */ 241 */
226 void Close([in] PP_Resource file_io); 242 void Close([in] PP_Resource file_io);
227 }; 243 };
228 244
OLDNEW
« no previous file with comments | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/c/ppb_file_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698