OLD | NEW |
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 // This file defines FileStream::Context class. | 5 // This file defines FileStream::Context class. |
6 // The general design of FileStream is as follows: file_stream.h defines | 6 // The general design of FileStream is as follows: file_stream.h defines |
7 // FileStream class which basically is just an "wrapper" not containing any | 7 // FileStream class which basically is just an "wrapper" not containing any |
8 // specific implementation details. It re-routes all its method calls to | 8 // specific implementation details. It re-routes all its method calls to |
9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to | 9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to |
10 // FileStream::Context instance). Context was extracted into a different class | 10 // FileStream::Context instance). Context was extracted into a different class |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 static void ReadAsync( | 182 static void ReadAsync( |
183 FileStream::Context* context, | 183 FileStream::Context* context, |
184 HANDLE file, | 184 HANDLE file, |
185 scoped_refptr<net::IOBuffer> buf, | 185 scoped_refptr<net::IOBuffer> buf, |
186 int buf_len, | 186 int buf_len, |
187 OVERLAPPED* overlapped, | 187 OVERLAPPED* overlapped, |
188 scoped_refptr<base::MessageLoopProxy> origin_thread_loop); | 188 scoped_refptr<base::MessageLoopProxy> origin_thread_loop); |
189 | 189 |
190 // This callback executes on the main calling thread. It informs the caller | 190 // This callback executes on the main calling thread. It informs the caller |
191 // about the result of the ReadFile call. | 191 // about the result of the ReadFile call. |
| 192 // The |read_file_ret| parameter contains the return value of the ReadFile |
| 193 // call. |
192 // The |bytes_read| contains the number of bytes read from the file, if | 194 // The |bytes_read| contains the number of bytes read from the file, if |
193 // ReadFile succeeds. | 195 // ReadFile succeeds. |
194 // The |os_error| parameter contains the value of the last error returned by | 196 // The |os_error| parameter contains the value of the last error returned by |
195 // the ReadFile API. | 197 // the ReadFile API. |
196 void ReadAsyncResult(DWORD bytes_read, DWORD os_error); | 198 void ReadAsyncResult(BOOL read_file_ret, DWORD bytes_read, DWORD os_error); |
197 | 199 |
198 #elif defined(OS_POSIX) | 200 #elif defined(OS_POSIX) |
199 // ReadFileImpl() is a simple wrapper around read() that handles EINTR | 201 // ReadFileImpl() is a simple wrapper around read() that handles EINTR |
200 // signals and calls RecordAndMapError() to map errno to net error codes. | 202 // signals and calls RecordAndMapError() to map errno to net error codes. |
201 IOResult ReadFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 203 IOResult ReadFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); |
202 | 204 |
203 // WriteFileImpl() is a simple wrapper around write() that handles EINTR | 205 // WriteFileImpl() is a simple wrapper around write() that handles EINTR |
204 // signals and calls MapSystemError() to map errno to net error codes. | 206 // signals and calls MapSystemError() to map errno to net error codes. |
205 // It tries to write to completion. | 207 // It tries to write to completion. |
206 IOResult WriteFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); | 208 IOResult WriteFileImpl(scoped_refptr<IOBuffer> buf, int buf_len); |
(...skipping 21 matching lines...) Expand all Loading... |
228 // Tracks the result of the IO completion operation. Set in OnIOComplete. | 230 // Tracks the result of the IO completion operation. Set in OnIOComplete. |
229 int result_; | 231 int result_; |
230 #endif | 232 #endif |
231 | 233 |
232 DISALLOW_COPY_AND_ASSIGN(Context); | 234 DISALLOW_COPY_AND_ASSIGN(Context); |
233 }; | 235 }; |
234 | 236 |
235 } // namespace net | 237 } // namespace net |
236 | 238 |
237 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ | 239 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ |
OLD | NEW |