diff options
Diffstat (limited to 'net/base/file_stream_win.cc')
-rw-r--r-- | net/base/file_stream_win.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc index d70b398..ca492a2 100644 --- a/net/base/file_stream_win.cc +++ b/net/base/file_stream_win.cc @@ -110,6 +110,17 @@ void FileStream::AsyncContext::OnIOCompleted( FileStream::FileStream() : file_(INVALID_HANDLE_VALUE) { } +FileStream::FileStream(base::PlatformFile file, int flags) + : file_(file), open_flags_(flags) { + // If the file handle is opened with base::PLATFORM_FILE_ASYNC, we need to + // make sure we will perform asynchronous File IO to it. + if (flags & base::PLATFORM_FILE_ASYNC) { + async_context_.reset(new AsyncContext(this)); + MessageLoopForIO::current()->RegisterIOHandler(file_, + async_context_.get()); + } +} + FileStream::~FileStream() { Close(); } |