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 | 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 Loading... | |
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 |
viettrungluu
2011/11/30 23:44:42
We should have tests for restrictions like this.
| |
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. |
viettrungluu
2011/11/30 23:44:42
Are there any concurrency restrictions for Touch?
| |
121 * | 124 * |
122 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 125 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
123 * FileIO. | 126 * FileIO. |
124 * @param[in] last_access_time The last time the FileIO was accessed. | 127 * @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. | 128 * @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 | 129 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
127 * completion of Touch(). | 130 * completion of Touch(). |
128 * | 131 * |
129 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | 132 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
130 */ | 133 */ |
(...skipping 12 matching lines...) Expand all Loading... | |
143 * @param[in] offset The offset into the file. | 146 * @param[in] offset The offset into the file. |
144 * @param[in] buffer The buffer to hold the specified number of bytes read. | 147 * @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 | 148 * @param[in] bytes_to_read The number of bytes to read from |
146 * <code>offset</code>. | 149 * <code>offset</code>. |
147 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 150 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
148 * completion of Read(). | 151 * completion of Read(). |
149 * | 152 * |
150 * @return An The number of bytes read an error code from | 153 * @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 | 154 * <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 | 155 * 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. | 156 * callback to queue up parallel reads from the file at different offsets, |
157 * but pending reads can not be interleaved with other operations. | |
viettrungluu
2011/11/30 23:44:42
s/can not/cannot/
| |
154 */ | 158 */ |
155 int32_t Read([in] PP_Resource file_io, | 159 int32_t Read([in] PP_Resource file_io, |
156 [in] int64_t offset, | 160 [in] int64_t offset, |
157 [inout] str_t buffer, | 161 [inout] str_t buffer, |
158 [in] int32_t bytes_to_read, | 162 [in] int32_t bytes_to_read, |
159 [in] PP_CompletionCallback callback); | 163 [in] PP_CompletionCallback callback); |
160 | 164 |
161 /** | 165 /** |
162 * Write() writes to an offset in the file. This function might perform a | 166 * 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. | 167 * partial write. The FileIO object must have been opened with write access. |
164 * | 168 * |
165 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 169 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
166 * FileIO. | 170 * FileIO. |
167 * @param[in] offset The offset into the file. | 171 * @param[in] offset The offset into the file. |
168 * @param[in] buffer The buffer to hold the specified number of bytes read. | 172 * @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 | 173 * @param[in] bytes_to_write The number of bytes to write to |
170 * <code>offset</code>. | 174 * <code>offset</code>. |
171 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 175 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
172 * completion of Write(). | 176 * completion of Write(). |
173 * | 177 * |
174 * @return An The number of bytes written or an error code from | 178 * @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 | 179 * <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 | 180 * 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. | 181 * callback to queue up parallel writes to the file at different offsets, but |
182 * pending writes can not be interleaved with other operations. | |
viettrungluu
2011/11/30 23:44:42
s/can not/cannot/
Also, does "different offsets"
| |
178 */ | 183 */ |
179 int32_t Write([in] PP_Resource file_io, | 184 int32_t Write([in] PP_Resource file_io, |
180 [in] int64_t offset, | 185 [in] int64_t offset, |
181 [in] str_t buffer, | 186 [in] str_t buffer, |
182 [in] int32_t bytes_to_write, | 187 [in] int32_t bytes_to_write, |
183 [in] PP_CompletionCallback callback); | 188 [in] PP_CompletionCallback callback); |
184 /** | 189 /** |
185 * SetLength() sets the length of the file. If the file size is extended, | 190 * 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 | 191 * then the extended area of the file is zero-filled. The FileIO object must |
187 * have been opened with write access. | 192 * have been opened with write access. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 * <strong>Note:</strong> If the FileIO object is destroyed, and it is still | 224 * <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 | 225 * open, then it will be implicitly closed, so you are not required to call |
221 * Close(). | 226 * Close(). |
222 * | 227 * |
223 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file | 228 * @param[in] file_io A <code>PP_Resource</code> corresponding to a file |
224 * FileIO. | 229 * FileIO. |
225 */ | 230 */ |
226 void Close([in] PP_Resource file_io); | 231 void Close([in] PP_Resource file_io); |
227 }; | 232 }; |
228 | 233 |
OLD | NEW |