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

Side by Side Diff: net/base/file_stream_context_win.cc

Issue 1954543002: Remove handler from MessagePumpForIO::IOContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_observers
Patch Set: CR thestig #17 Created 4 years, 7 months 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 | « mojo/edk/system/channel_win.cc ('k') | net/disk_cache/blockfile/file_win.cc » ('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 #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 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 22 matching lines...) Expand all
33 offset.QuadPart += static_cast<LONGLONG>(count); 33 offset.QuadPart += static_cast<LONGLONG>(count);
34 SetOffset(overlapped, offset); 34 SetOffset(overlapped, offset);
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner) 39 FileStream::Context::Context(const scoped_refptr<base::TaskRunner>& task_runner)
40 : async_in_progress_(false), 40 : async_in_progress_(false),
41 orphaned_(false), 41 orphaned_(false),
42 task_runner_(task_runner), 42 task_runner_(task_runner),
43 io_context_(),
44 async_read_initiated_(false), 43 async_read_initiated_(false),
45 async_read_completed_(false), 44 async_read_completed_(false),
46 io_complete_for_read_received_(false), 45 io_complete_for_read_received_(false),
47 result_(0) { 46 result_(0) {}
48 io_context_.handler = this;
49 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped));
50 }
51 47
52 FileStream::Context::Context(base::File file, 48 FileStream::Context::Context(base::File file,
53 const scoped_refptr<base::TaskRunner>& task_runner) 49 const scoped_refptr<base::TaskRunner>& task_runner)
54 : file_(std::move(file)), 50 : file_(std::move(file)),
55 async_in_progress_(false), 51 async_in_progress_(false),
56 orphaned_(false), 52 orphaned_(false),
57 task_runner_(task_runner), 53 task_runner_(task_runner),
58 io_context_(),
59 async_read_initiated_(false), 54 async_read_initiated_(false),
60 async_read_completed_(false), 55 async_read_completed_(false),
61 io_complete_for_read_received_(false), 56 io_complete_for_read_received_(false),
62 result_(0) { 57 result_(0) {
63 io_context_.handler = this;
64 memset(&io_context_.overlapped, 0, sizeof(io_context_.overlapped));
65 if (file_.IsValid()) { 58 if (file_.IsValid()) {
66 DCHECK(file_.async()); 59 DCHECK(file_.async());
67 OnFileOpened(); 60 OnFileOpened();
68 } 61 }
69 } 62 }
70 63
71 FileStream::Context::~Context() { 64 FileStream::Context::~Context() {
72 } 65 }
73 66
74 int FileStream::Context::Read(IOBuffer* buf, 67 int FileStream::Context::Read(IOBuffer* buf,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 229
237 IOResult error = IOResult::FromOSError(os_error); 230 IOResult error = IOResult::FromOSError(os_error);
238 if (error.os_error == ERROR_IO_PENDING) { 231 if (error.os_error == ERROR_IO_PENDING) {
239 InvokeUserCallback(); 232 InvokeUserCallback();
240 } else { 233 } else {
241 OnIOCompleted(&io_context_, 0, error.os_error); 234 OnIOCompleted(&io_context_, 0, error.os_error);
242 } 235 }
243 } 236 }
244 237
245 } // namespace net 238 } // namespace net
OLDNEW
« no previous file with comments | « mojo/edk/system/channel_win.cc ('k') | net/disk_cache/blockfile/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698