| 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 <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 base::Unretained(this), | 73 base::Unretained(this), |
| 74 IntToInt64(callback))); | 74 IntToInt64(callback))); |
| 75 DCHECK(posted); | 75 DCHECK(posted); |
| 76 | 76 |
| 77 async_in_progress_ = true; | 77 async_in_progress_ = true; |
| 78 return ERR_IO_PENDING; | 78 return ERR_IO_PENDING; |
| 79 } | 79 } |
| 80 | 80 |
| 81 FileStream::Context::IOResult FileStream::Context::SeekFileImpl( | 81 FileStream::Context::IOResult FileStream::Context::SeekFileImpl( |
| 82 base::File::Whence whence, | 82 base::File::Whence whence, |
| 83 int64 offset) { | 83 int64_t offset) { |
| 84 int64 res = file_.Seek(whence, offset); | 84 int64_t res = file_.Seek(whence, offset); |
| 85 if (res == -1) | 85 if (res == -1) |
| 86 return IOResult::FromOSError(errno); | 86 return IOResult::FromOSError(errno); |
| 87 | 87 |
| 88 return IOResult(res, 0); | 88 return IOResult(res, 0); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void FileStream::Context::OnFileOpened() { | 91 void FileStream::Context::OnFileOpened() { |
| 92 } | 92 } |
| 93 | 93 |
| 94 FileStream::Context::IOResult FileStream::Context::ReadFileImpl( | 94 FileStream::Context::IOResult FileStream::Context::ReadFileImpl( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 scoped_refptr<IOBuffer> buf, | 109 scoped_refptr<IOBuffer> buf, |
| 110 int buf_len) { | 110 int buf_len) { |
| 111 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); | 111 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); |
| 112 if (res == -1) | 112 if (res == -1) |
| 113 return IOResult::FromOSError(errno); | 113 return IOResult::FromOSError(errno); |
| 114 | 114 |
| 115 return IOResult(res, 0); | 115 return IOResult(res, 0); |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace net | 118 } // namespace net |
| OLD | NEW |