| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 LOG(WARNING) << "WriteFile failed: " << error.os_error; | 109 LOG(WARNING) << "WriteFile failed: " << error.os_error; |
| 110 return static_cast<int>(error.result); | 110 return static_cast<int>(error.result); |
| 111 } | 111 } |
| 112 | 112 |
| 113 IOCompletionIsPending(callback, buf); | 113 IOCompletionIsPending(callback, buf); |
| 114 return ERR_IO_PENDING; | 114 return ERR_IO_PENDING; |
| 115 } | 115 } |
| 116 | 116 |
| 117 FileStream::Context::IOResult FileStream::Context::SeekFileImpl( | 117 FileStream::Context::IOResult FileStream::Context::SeekFileImpl( |
| 118 base::File::Whence whence, | 118 base::File::Whence whence, |
| 119 int64 offset) { | 119 int64_t offset) { |
| 120 LARGE_INTEGER result; | 120 LARGE_INTEGER result; |
| 121 result.QuadPart = file_.Seek(whence, offset); | 121 result.QuadPart = file_.Seek(whence, offset); |
| 122 if (result.QuadPart >= 0) { | 122 if (result.QuadPart >= 0) { |
| 123 SetOffset(&io_context_.overlapped, result); | 123 SetOffset(&io_context_.overlapped, result); |
| 124 return IOResult(result.QuadPart, 0); | 124 return IOResult(result.QuadPart, 0); |
| 125 } | 125 } |
| 126 | 126 |
| 127 return IOResult::FromOSError(GetLastError()); | 127 return IOResult::FromOSError(GetLastError()); |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 IOResult error = IOResult::FromOSError(os_error); | 242 IOResult error = IOResult::FromOSError(os_error); |
| 243 if (error.os_error == ERROR_IO_PENDING) { | 243 if (error.os_error == ERROR_IO_PENDING) { |
| 244 InvokeUserCallback(); | 244 InvokeUserCallback(); |
| 245 } else { | 245 } else { |
| 246 OnIOCompleted(&io_context_, 0, error.os_error); | 246 OnIOCompleted(&io_context_, 0, error.os_error); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace net | 250 } // namespace net |
| OLD | NEW |