| 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/upload_bytes_element_reader.h" | 5 #include "net/base/upload_bytes_element_reader.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 UploadBytesElementReader::UploadBytesElementReader(const char* bytes, | 12 UploadBytesElementReader::UploadBytesElementReader(const char* bytes, |
| 13 int bytes_length) | 13 int bytes_length) |
| 14 : bytes_(bytes), | 14 : bytes_(bytes), |
| 15 bytes_length_(bytes_length), | 15 bytes_length_(bytes_length), |
| 16 offset_(0) { | 16 offset_(0) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 UploadBytesElementReader::~UploadBytesElementReader() { | 19 UploadBytesElementReader::~UploadBytesElementReader() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 int UploadBytesElementReader::Init(const CompletionCallback& callback) { |
| 23 return OK; |
| 24 } |
| 25 |
| 22 int UploadBytesElementReader::InitSync() { | 26 int UploadBytesElementReader::InitSync() { |
| 23 return OK; | 27 return OK; |
| 24 } | 28 } |
| 25 | 29 |
| 26 uint64 UploadBytesElementReader::GetContentLength() const { | 30 uint64 UploadBytesElementReader::GetContentLength() const { |
| 27 return bytes_length_; | 31 return bytes_length_; |
| 28 } | 32 } |
| 29 | 33 |
| 30 uint64 UploadBytesElementReader::BytesRemaining() const { | 34 uint64 UploadBytesElementReader::BytesRemaining() const { |
| 31 return bytes_length_ - offset_; | 35 return bytes_length_ - offset_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 | 49 |
| 46 offset_ += num_bytes_to_read; | 50 offset_ += num_bytes_to_read; |
| 47 return num_bytes_to_read; | 51 return num_bytes_to_read; |
| 48 } | 52 } |
| 49 | 53 |
| 50 bool UploadBytesElementReader::IsInMemory() const { | 54 bool UploadBytesElementReader::IsInMemory() const { |
| 51 return true; | 55 return true; |
| 52 } | 56 } |
| 53 | 57 |
| 54 } // namespace net | 58 } // namespace net |
| OLD | NEW |