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 #include <utility> |
8 | 9 |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/location.h" | 11 #include "base/location.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
14 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
15 #include "base/threading/worker_pool.h" | 16 #include "base/threading/worker_pool.h" |
16 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
(...skipping 25 matching lines...) Expand all Loading... |
43 async_read_initiated_(false), | 44 async_read_initiated_(false), |
44 async_read_completed_(false), | 45 async_read_completed_(false), |
45 io_complete_for_read_received_(false), | 46 io_complete_for_read_received_(false), |
46 result_(0) { | 47 result_(0) { |
47 io_context_.handler = this; | 48 io_context_.handler = this; |
48 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); | 49 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); |
49 } | 50 } |
50 | 51 |
51 FileStream::Context::Context(base::File file, | 52 FileStream::Context::Context(base::File file, |
52 const scoped_refptr<base::TaskRunner>& task_runner) | 53 const scoped_refptr<base::TaskRunner>& task_runner) |
53 : file_(file.Pass()), | 54 : file_(std::move(file)), |
54 async_in_progress_(false), | 55 async_in_progress_(false), |
55 orphaned_(false), | 56 orphaned_(false), |
56 task_runner_(task_runner), | 57 task_runner_(task_runner), |
57 io_context_(), | 58 io_context_(), |
58 async_read_initiated_(false), | 59 async_read_initiated_(false), |
59 async_read_completed_(false), | 60 async_read_completed_(false), |
60 io_complete_for_read_received_(false), | 61 io_complete_for_read_received_(false), |
61 result_(0) { | 62 result_(0) { |
62 io_context_.handler = this; | 63 io_context_.handler = this; |
63 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); | 64 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 236 |
236 IOResult error = IOResult::FromOSError(os_error); | 237 IOResult error = IOResult::FromOSError(os_error); |
237 if (error.os_error == ERROR_IO_PENDING) { | 238 if (error.os_error == ERROR_IO_PENDING) { |
238 InvokeUserCallback(); | 239 InvokeUserCallback(); |
239 } else { | 240 } else { |
240 OnIOCompleted(&io_context_, 0, error.os_error); | 241 OnIOCompleted(&io_context_, 0, error.os_error); |
241 } | 242 } |
242 } | 243 } |
243 | 244 |
244 } // namespace net | 245 } // namespace net |
OLD | NEW |