| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cronet/android/wrapped_channel_upload_element_reader.h" | 5 #include "components/cronet/android/wrapped_channel_upload_element_reader.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool WrappedChannelElementReader::IsInMemory() const { | 36 bool WrappedChannelElementReader::IsInMemory() const { |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 int WrappedChannelElementReader::Read(net::IOBuffer* buf, | 40 int WrappedChannelElementReader::Read(net::IOBuffer* buf, |
| 41 int buf_length, | 41 int buf_length, |
| 42 const net::CompletionCallback& callback) { | 42 const net::CompletionCallback& callback) { |
| 43 DCHECK(!callback.is_null()); | 43 DCHECK(!callback.is_null()); |
| 44 DCHECK(delegate_); | 44 DCHECK(delegate_.get()); |
| 45 // TODO(mef): Post the read to file thread. | 45 // TODO(mef): Post the read to file thread. |
| 46 int bytes_read = delegate_->ReadFromUploadChannel(buf, buf_length); | 46 int bytes_read = delegate_->ReadFromUploadChannel(buf, buf_length); |
| 47 if (bytes_read < 0) | 47 if (bytes_read < 0) |
| 48 return net::ERR_FAILED; | 48 return net::ERR_FAILED; |
| 49 offset_ += bytes_read; | 49 offset_ += bytes_read; |
| 50 return bytes_read; | 50 return bytes_read; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace cronet | 53 } // namespace cronet |
| 54 | 54 |
| OLD | NEW |