| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/http/bidirectional_stream.h" | 5 #include "net/http/bidirectional_stream.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (rv > 0) { | 138 if (rv > 0) { |
| 139 net_log_.AddByteTransferEvent( | 139 net_log_.AddByteTransferEvent( |
| 140 NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_RECEIVED, rv, buf->data()); | 140 NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_RECEIVED, rv, buf->data()); |
| 141 } else if (rv == ERR_IO_PENDING) { | 141 } else if (rv == ERR_IO_PENDING) { |
| 142 read_buffer_ = buf; | 142 read_buffer_ = buf; |
| 143 // Bytes will be logged in OnDataRead(). | 143 // Bytes will be logged in OnDataRead(). |
| 144 } | 144 } |
| 145 return rv; | 145 return rv; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void BidirectionalStream::SendData(IOBuffer* data, | 148 void BidirectionalStream::SendData(const scoped_refptr<IOBuffer>& data, |
| 149 int length, | 149 int length, |
| 150 bool end_stream) { | 150 bool end_stream) { |
| 151 DCHECK(stream_impl_); | 151 DCHECK(stream_impl_); |
| 152 DCHECK(write_buffer_list_.empty()); | 152 DCHECK(write_buffer_list_.empty()); |
| 153 DCHECK(write_buffer_len_list_.empty()); | 153 DCHECK(write_buffer_len_list_.empty()); |
| 154 | 154 |
| 155 stream_impl_->SendData(data, length, end_stream); | 155 stream_impl_->SendData(data, length, end_stream); |
| 156 write_buffer_list_.push_back(data); | 156 write_buffer_list_.push_back(data); |
| 157 write_buffer_len_list_.push_back(length); | 157 write_buffer_len_list_.push_back(length); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void BidirectionalStream::SendvData(const std::vector<IOBuffer*>& buffers, | 160 void BidirectionalStream::SendvData( |
| 161 const std::vector<int>& lengths, | 161 const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| 162 bool end_stream) { | 162 const std::vector<int>& lengths, |
| 163 bool end_stream) { |
| 163 DCHECK(stream_impl_); | 164 DCHECK(stream_impl_); |
| 164 DCHECK_EQ(buffers.size(), lengths.size()); | 165 DCHECK_EQ(buffers.size(), lengths.size()); |
| 165 DCHECK(write_buffer_list_.empty()); | 166 DCHECK(write_buffer_list_.empty()); |
| 166 DCHECK(write_buffer_len_list_.empty()); | 167 DCHECK(write_buffer_len_list_.empty()); |
| 167 | 168 |
| 168 stream_impl_->SendvData(buffers, lengths, end_stream); | 169 stream_impl_->SendvData(buffers, lengths, end_stream); |
| 169 for (size_t i = 0; i < buffers.size(); ++i) { | 170 for (size_t i = 0; i < buffers.size(); ++i) { |
| 170 write_buffer_list_.push_back(buffers[i]); | 171 write_buffer_list_.push_back(buffers[i]); |
| 171 write_buffer_len_list_.push_back(lengths[i]); | 172 write_buffer_len_list_.push_back(lengths[i]); |
| 172 } | 173 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 const ProxyInfo& used_proxy_info, | 332 const ProxyInfo& used_proxy_info, |
| 332 HttpStream* stream) { | 333 HttpStream* stream) { |
| 333 DCHECK(stream_request_); | 334 DCHECK(stream_request_); |
| 334 | 335 |
| 335 delegate_->OnFailed(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 336 delegate_->OnFailed(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
| 336 } | 337 } |
| 337 | 338 |
| 338 void BidirectionalStream::OnQuicBroken() {} | 339 void BidirectionalStream::OnQuicBroken() {} |
| 339 | 340 |
| 340 } // namespace net | 341 } // namespace net |
| OLD | NEW |