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 #include "net/base/file_stream_context.h" | 5 #include "net/base/file_stream_context.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 LARGE_INTEGER offset; | 29 LARGE_INTEGER offset; |
30 offset.LowPart = overlapped->Offset; | 30 offset.LowPart = overlapped->Offset; |
31 offset.HighPart = overlapped->OffsetHigh; | 31 offset.HighPart = overlapped->OffsetHigh; |
32 offset.QuadPart += static_cast<LONGLONG>(count); | 32 offset.QuadPart += static_cast<LONGLONG>(count); |
33 SetOffset(overlapped, offset); | 33 SetOffset(overlapped, offset); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) | 38 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) |
39 : io_context_(), | 39 : async_in_progress_(false), |
40 async_in_progress_(false), | |
41 orphaned_(false), | 40 orphaned_(false), |
42 task_runner_(task_runner), | 41 task_runner_(task_runner), |
| 42 io_context_(), |
43 async_read_initiated_(false), | 43 async_read_initiated_(false), |
44 async_read_completed_(false), | 44 async_read_completed_(false), |
45 io_complete_for_read_received_(false), | 45 io_complete_for_read_received_(false), |
46 result_(0) { | 46 result_(0) { |
47 io_context_.handler = this; | 47 io_context_.handler = this; |
48 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); | 48 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); |
49 } | 49 } |
50 | 50 |
51 FileStream::Context::Context(base::File file, | 51 FileStream::Context::Context(base::File file, |
52 const scoped_refptr<base::TaskRunner>& task_runner) | 52 const scoped_refptr<base::TaskRunner>& task_runner) |
53 : io_context_(), | 53 : file_(file.Pass()), |
54 file_(file.Pass()), | |
55 async_in_progress_(false), | 54 async_in_progress_(false), |
56 orphaned_(false), | 55 orphaned_(false), |
57 task_runner_(task_runner), | 56 task_runner_(task_runner), |
| 57 io_context_(), |
58 async_read_initiated_(false), | 58 async_read_initiated_(false), |
59 async_read_completed_(false), | 59 async_read_completed_(false), |
60 io_complete_for_read_received_(false), | 60 io_complete_for_read_received_(false), |
61 result_(0) { | 61 result_(0) { |
62 io_context_.handler = this; | 62 io_context_.handler = this; |
63 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); | 63 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); |
64 if (file_.IsValid()) { | 64 if (file_.IsValid()) { |
65 DCHECK(file_.async()); | 65 DCHECK(file_.async()); |
66 OnFileOpened(); | 66 OnFileOpened(); |
67 } | 67 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 IOResult error = IOResult::FromOSError(os_error); | 236 IOResult error = IOResult::FromOSError(os_error); |
237 if (error.os_error == ERROR_IO_PENDING) { | 237 if (error.os_error == ERROR_IO_PENDING) { |
238 InvokeUserCallback(); | 238 InvokeUserCallback(); |
239 } else { | 239 } else { |
240 OnIOCompleted(&io_context_, 0, error.os_error); | 240 OnIOCompleted(&io_context_, 0, error.os_error); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 } // namespace net | 244 } // namespace net |
OLD | NEW |