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

Side by Side Diff: ppapi/cpp/file_io.h

Issue 11417145: Provide a safer URLLoader ReadResponseBody API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « ppapi/c/ppb_url_loader.h ('k') | ppapi/cpp/url_loader.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) 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 #ifndef PPAPI_CPP_FILE_IO_H_ 5 #ifndef PPAPI_CPP_FILE_IO_H_
6 #define PPAPI_CPP_FILE_IO_H_ 6 #define PPAPI_CPP_FILE_IO_H_
7 7
8 #include "ppapi/c/pp_time.h" 8 #include "ppapi/c/pp_time.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/resource.h" 10 #include "ppapi/cpp/resource.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 /// callback to queue up parallel reads from the file at different offsets. 146 /// callback to queue up parallel reads from the file at different offsets.
147 int32_t Read(int64_t offset, 147 int32_t Read(int64_t offset,
148 char* buffer, 148 char* buffer,
149 int32_t bytes_to_read, 149 int32_t bytes_to_read,
150 const CompletionCallback& cc); 150 const CompletionCallback& cc);
151 151
152 /// Read() reads from an offset in the file. A PP_ArrayOutput must be 152 /// Read() reads from an offset in the file. A PP_ArrayOutput must be
153 /// provided so that output will be stored in its allocated buffer. This 153 /// provided so that output will be stored in its allocated buffer. This
154 /// function might perform a partial read. 154 /// function might perform a partial read.
155 /// 155 ///
156 /// @param[in] file_io A <code>PP_Resource</code> corresponding to a file
157 /// FileIO.
158 /// @param[in] offset The offset into the file. 156 /// @param[in] offset The offset into the file.
159 /// @param[in] max_read_length The maximum number of bytes to read from 157 /// @param[in] max_read_length The maximum number of bytes to read from
160 /// <code>offset</code>. 158 /// <code>offset</code>.
161 /// @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. 159 /// @param[in] cc A <code>CompletionCallbackWithOutput</code> to hold a
162 /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon 160 /// PP_ArrayOutput for output, and to be called upon completion of Read().
163 /// completion of Read().
164 /// 161 ///
165 /// @return The number of bytes read or an error code from 162 /// @return The number of bytes read or an error code from
166 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was 163 /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
167 /// reached. It is valid to call Read() multiple times with a completion 164 /// reached. It is valid to call Read() multiple times with a completion
168 /// callback to queue up parallel reads from the file, but pending reads 165 /// callback to queue up parallel reads from the file, but pending reads
169 /// cannot be interleaved with other operations. 166 /// cannot be interleaved with other operations.
170 int32_t Read(int32_t offset, 167 int32_t Read(int32_t offset,
171 int32_t max_read_length, 168 int32_t max_read_length,
172 const CompletionCallbackWithOutput< std::vector<char> >& cc); 169 const CompletionCallbackWithOutput< std::vector<char> >& cc);
173 170
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // interface in 1.1. 231 // interface in 1.1.
235 // 232 //
236 // This takes a heap-allocated CallbackData1_0 struct passed as the user data 233 // This takes a heap-allocated CallbackData1_0 struct passed as the user data
237 // and deletes it when the call completes. 234 // and deletes it when the call completes.
238 static void CallbackConverter(void* user_data, int32_t result); 235 static void CallbackConverter(void* user_data, int32_t result);
239 }; 236 };
240 237
241 } // namespace pp 238 } // namespace pp
242 239
243 #endif // PPAPI_CPP_FILE_IO_H_ 240 #endif // PPAPI_CPP_FILE_IO_H_
OLDNEW
« no previous file with comments | « ppapi/c/ppb_url_loader.h ('k') | ppapi/cpp/url_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698