Chromium Code Reviews| Index: net/base/upload_bytes_element_reader.cc |
| diff --git a/net/base/upload_bytes_element_reader.cc b/net/base/upload_bytes_element_reader.cc |
| index 9beb1f436d6573e51383b83fd489e933d3419bd8..ffd93d4e825d341de22e71257f67044dd005f8dc 100644 |
| --- a/net/base/upload_bytes_element_reader.cc |
| +++ b/net/base/upload_bytes_element_reader.cc |
| @@ -5,6 +5,7 @@ |
| #include "net/base/upload_bytes_element_reader.h" |
| #include "base/logging.h" |
| +#include "net/base/io_buffer.h" |
| #include "net/base/net_errors.h" |
| namespace net { |
| @@ -35,7 +36,17 @@ uint64 UploadBytesElementReader::BytesRemaining() const { |
| return bytes_length_ - offset_; |
| } |
| -int UploadBytesElementReader::ReadSync(char* buf, int buf_length) { |
| +bool UploadBytesElementReader::IsInMemory() const { |
| + return true; |
| +} |
| + |
| +int UploadBytesElementReader::Read(IOBuffer* buf, |
| + int buf_length, |
| + const CompletionCallback& callback) { |
|
mmenke
2012/10/15 19:54:45
DCHECK(!callback.is_null());
hashimoto
2012/10/16 11:52:20
Done.
|
| + return ReadSync(buf, buf_length); |
| +} |
| + |
| +int UploadBytesElementReader::ReadSync(IOBuffer* buf, int buf_length) { |
| DCHECK_LT(0, buf_length); |
| const size_t num_bytes_to_read = |
| @@ -45,14 +56,10 @@ int UploadBytesElementReader::ReadSync(char* buf, int buf_length) { |
| // the address of an element in |bytes_| and that will throw an |
| // exception if |bytes_| is an empty vector. |
| if (num_bytes_to_read > 0) |
| - memcpy(buf, bytes_ + offset_, num_bytes_to_read); |
| + memcpy(buf->data(), bytes_ + offset_, num_bytes_to_read); |
| offset_ += num_bytes_to_read; |
| return num_bytes_to_read; |
| } |
| -bool UploadBytesElementReader::IsInMemory() const { |
| - return true; |
| -} |
| - |
| } // namespace net |