| 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 // For 64-bit file access (off_t = off64_t, lseek64, etc). | 5 // For 64-bit file access (off_t = off64_t, lseek64, etc). |
| 6 #define _FILE_OFFSET_BITS 64 | 6 #define _FILE_OFFSET_BITS 64 |
| 7 | 7 |
| 8 #include "net/base/file_stream_context.h" | 8 #include "net/base/file_stream_context.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 FileStream::Context::IOResult FileStream::Context::WriteFileImpl( | 177 FileStream::Context::IOResult FileStream::Context::WriteFileImpl( |
| 178 scoped_refptr<IOBuffer> buf, | 178 scoped_refptr<IOBuffer> buf, |
| 179 int buf_len) { | 179 int buf_len) { |
| 180 ssize_t res = HANDLE_EINTR(write(file_, buf->data(), buf_len)); | 180 ssize_t res = HANDLE_EINTR(write(file_, buf->data(), buf_len)); |
| 181 if (res == -1) | 181 if (res == -1) |
| 182 return IOResult::FromOSError(errno); | 182 return IOResult::FromOSError(errno); |
| 183 | 183 |
| 184 return IOResult(res, 0); | 184 return IOResult(res, 0); |
| 185 } | 185 } |
| 186 | 186 |
| 187 FileStream::Context::IOResult FileStream::Context::CloseFileImpl() { |
| 188 bool success = base::ClosePlatformFile(file_); |
| 189 file_ = base::kInvalidPlatformFileValue; |
| 190 if (!success) |
| 191 return IOResult::FromOSError(errno); |
| 192 |
| 193 return IOResult(OK, 0); |
| 194 } |
| 195 |
| 187 } // namespace net | 196 } // namespace net |
| OLD | NEW |