| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 read_buffer_ = buf; | 160 read_buffer_ = buf; |
| 161 // Bytes will be logged in OnDataRead(). | 161 // Bytes will be logged in OnDataRead(). |
| 162 } | 162 } |
| 163 if (net_log_.IsCapturing()) { | 163 if (net_log_.IsCapturing()) { |
| 164 net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_READ_DATA, | 164 net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_READ_DATA, |
| 165 NetLog::IntCallback("rv", rv)); | 165 NetLog::IntCallback("rv", rv)); |
| 166 } | 166 } |
| 167 return rv; | 167 return rv; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void BidirectionalStream::SendData(const scoped_refptr<IOBuffer>& data, | |
| 171 int length, | |
| 172 bool end_stream) { | |
| 173 DCHECK(stream_impl_); | |
| 174 DCHECK(write_buffer_list_.empty()); | |
| 175 DCHECK(write_buffer_len_list_.empty()); | |
| 176 | |
| 177 if (net_log_.IsCapturing()) { | |
| 178 net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_SEND_DATA); | |
| 179 } | |
| 180 stream_impl_->SendData(data, length, end_stream); | |
| 181 write_buffer_list_.push_back(data); | |
| 182 write_buffer_len_list_.push_back(length); | |
| 183 } | |
| 184 | |
| 185 void BidirectionalStream::SendvData( | 170 void BidirectionalStream::SendvData( |
| 186 const std::vector<scoped_refptr<IOBuffer>>& buffers, | 171 const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| 187 const std::vector<int>& lengths, | 172 const std::vector<int>& lengths, |
| 188 bool end_stream) { | 173 bool end_stream) { |
| 189 DCHECK(stream_impl_); | 174 DCHECK(stream_impl_); |
| 190 DCHECK_EQ(buffers.size(), lengths.size()); | 175 DCHECK_EQ(buffers.size(), lengths.size()); |
| 191 DCHECK(write_buffer_list_.empty()); | 176 DCHECK(write_buffer_list_.empty()); |
| 192 DCHECK(write_buffer_len_list_.empty()); | 177 DCHECK(write_buffer_len_list_.empty()); |
| 193 | 178 |
| 194 if (net_log_.IsCapturing()) { | 179 if (net_log_.IsCapturing()) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 "Net.BidirectionalStream.TimeToSendEnd.QUIC", | 427 "Net.BidirectionalStream.TimeToSendEnd.QUIC", |
| 443 load_timing_info_.send_end - load_timing_info_.request_start); | 428 load_timing_info_.send_end - load_timing_info_.request_start); |
| 444 UMA_HISTOGRAM_COUNTS("Net.BidirectionalStream.ReceivedBytes.QUIC", | 429 UMA_HISTOGRAM_COUNTS("Net.BidirectionalStream.ReceivedBytes.QUIC", |
| 445 stream_impl_->GetTotalReceivedBytes()); | 430 stream_impl_->GetTotalReceivedBytes()); |
| 446 UMA_HISTOGRAM_COUNTS("Net.BidirectionalStream.SentBytes.QUIC", | 431 UMA_HISTOGRAM_COUNTS("Net.BidirectionalStream.SentBytes.QUIC", |
| 447 stream_impl_->GetTotalSentBytes()); | 432 stream_impl_->GetTotalSentBytes()); |
| 448 } | 433 } |
| 449 } | 434 } |
| 450 | 435 |
| 451 } // namespace net | 436 } // namespace net |
| OLD | NEW |