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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 base::Bind(&Context::OnAsyncCompleted, | 72 base::Bind(&Context::OnAsyncCompleted, |
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, | |
83 int64_t offset) { | 82 int64_t offset) { |
84 int64_t res = file_.Seek(whence, offset); | 83 int64_t res = file_.Seek(base::File::FROM_BEGIN, offset); |
85 if (res == -1) | 84 if (res == -1) |
86 return IOResult::FromOSError(errno); | 85 return IOResult::FromOSError(errno); |
87 | 86 |
88 return IOResult(res, 0); | 87 return IOResult(res, 0); |
89 } | 88 } |
90 | 89 |
91 void FileStream::Context::OnFileOpened() { | 90 void FileStream::Context::OnFileOpened() { |
92 } | 91 } |
93 | 92 |
94 FileStream::Context::IOResult FileStream::Context::ReadFileImpl( | 93 FileStream::Context::IOResult FileStream::Context::ReadFileImpl( |
(...skipping 14 matching lines...) Expand all Loading... |
109 scoped_refptr<IOBuffer> buf, | 108 scoped_refptr<IOBuffer> buf, |
110 int buf_len) { | 109 int buf_len) { |
111 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); | 110 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); |
112 if (res == -1) | 111 if (res == -1) |
113 return IOResult::FromOSError(errno); | 112 return IOResult::FromOSError(errno); |
114 | 113 |
115 return IOResult(res, 0); | 114 return IOResult(res, 0); |
116 } | 115 } |
117 | 116 |
118 } // namespace net | 117 } // namespace net |
OLD | NEW |