Chromium Code Reviews| Index: net/base/file_stream_context_win.cc |
| diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc |
| index 5ffbde72388293a339e46430846f4be6df62695c..e6c1b528bc09cf130054ebcd71118283716c24cc 100644 |
| --- a/net/base/file_stream_context_win.cc |
| +++ b/net/base/file_stream_context_win.cc |
| @@ -174,6 +174,8 @@ void FileStream::Context::OnIOCompleted( |
| } |
| void FileStream::Context::InvokeUserCallback() { |
| + if (callback_.is_null()) |
| + return; |
| // For an asynchonous Read operation don't invoke the user callback until |
| // we receive the IO completion notification and the asynchronous Read |
| // completion notification. |
| @@ -203,15 +205,18 @@ void FileStream::Context::ReadAsync( |
| DWORD bytes_read = 0; |
| BOOL ret = ::ReadFile(file, buf->data(), buf_len, &bytes_read, overlapped); |
| origin_thread_loop->PostTask( |
| - FROM_HERE, base::Bind(&FileStream::Context::ReadAsyncResult, |
| - base::Unretained(context), ret ? bytes_read : 0, |
| - ret ? 0 : ::GetLastError())); |
| + FROM_HERE, |
| + base::Bind(&FileStream::Context::ReadAsyncResult, |
| + base::Unretained(context), ret, bytes_read, ::GetLastError())); |
| } |
| -void FileStream::Context::ReadAsyncResult(DWORD bytes_read, DWORD os_error) { |
| - if (!os_error) |
| +void FileStream::Context::ReadAsyncResult(BOOL read_file_ret, |
| + DWORD bytes_read, |
| + DWORD os_error) { |
| + if (read_file_ret) { |
|
rvargas (doing something else)
2015/02/12 23:53:35
Note that the original logic was:
DWORD byt
ananta
2015/02/13 00:17:00
Did something similar.
|
| + DCHECK(!os_error); |
| result_ = bytes_read; |
| - |
| + } |
| IOResult error = IOResult::FromOSError(os_error); |
| if (error.os_error == ERROR_HANDLE_EOF) { |
| // Report EOF by returning 0 bytes read. |