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/elements_upload_data_stream.h" | 5 #include "net/base/elements_upload_data_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 std::unique_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( | 29 std::unique_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( |
30 std::unique_ptr<UploadElementReader> reader, | 30 std::unique_ptr<UploadElementReader> reader, |
31 int64_t identifier) { | 31 int64_t identifier) { |
32 std::vector<std::unique_ptr<UploadElementReader>> readers; | 32 std::vector<std::unique_ptr<UploadElementReader>> readers; |
33 readers.push_back(std::move(reader)); | 33 readers.push_back(std::move(reader)); |
34 return std::unique_ptr<UploadDataStream>( | 34 return std::unique_ptr<UploadDataStream>( |
35 new ElementsUploadDataStream(std::move(readers), identifier)); | 35 new ElementsUploadDataStream(std::move(readers), identifier)); |
36 } | 36 } |
37 | 37 |
38 int ElementsUploadDataStream::InitInternal(const BoundNetLog& net_log) { | 38 int ElementsUploadDataStream::InitInternal(const NetLogWithSource& net_log) { |
39 return InitElements(0); | 39 return InitElements(0); |
40 } | 40 } |
41 | 41 |
42 int ElementsUploadDataStream::ReadInternal( | 42 int ElementsUploadDataStream::ReadInternal( |
43 IOBuffer* buf, | 43 IOBuffer* buf, |
44 int buf_len) { | 44 int buf_len) { |
45 DCHECK_GT(buf_len, 0); | 45 DCHECK_GT(buf_len, 0); |
46 return ReadElements(new DrainableIOBuffer(buf, buf_len)); | 46 return ReadElements(new DrainableIOBuffer(buf, buf_len)); |
47 } | 47 } |
48 | 48 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 DCHECK(!read_error_); | 148 DCHECK(!read_error_); |
149 | 149 |
150 if (result >= 0) { | 150 if (result >= 0) { |
151 buf->DidConsume(result); | 151 buf->DidConsume(result); |
152 } else { | 152 } else { |
153 read_error_ = result; | 153 read_error_ = result; |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 } // namespace net | 157 } // namespace net |
OLD | NEW |