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/quic/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "net/quic/iovector.h" | 9 #include "net/quic/iovector.h" |
10 #include "net/quic/quic_flow_controller.h" | 10 #include "net/quic/quic_flow_controller.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Original delegate. delegate_->OnAckNotification will be called when: | 89 // Original delegate. delegate_->OnAckNotification will be called when: |
90 // wrote_last_data_ == true and pending_acks_ == 0 | 90 // wrote_last_data_ == true and pending_acks_ == 0 |
91 scoped_refptr<DelegateInterface> delegate_; | 91 scoped_refptr<DelegateInterface> delegate_; |
92 | 92 |
93 // Number of outstanding acks. | 93 // Number of outstanding acks. |
94 int pending_acks_; | 94 int pending_acks_; |
95 | 95 |
96 // True if no pending writes remain. | 96 // True if no pending writes remain. |
97 bool wrote_last_data_; | 97 bool wrote_last_data_; |
98 | 98 |
99 // Accumulators. | |
100 int num_original_packets_; | |
101 int num_original_bytes_; | |
102 int num_retransmitted_packets_; | 99 int num_retransmitted_packets_; |
103 int num_retransmitted_bytes_; | 100 int num_retransmitted_bytes_; |
104 | 101 |
105 DISALLOW_COPY_AND_ASSIGN(ProxyAckNotifierDelegate); | 102 DISALLOW_COPY_AND_ASSIGN(ProxyAckNotifierDelegate); |
106 }; | 103 }; |
107 | 104 |
108 ReliableQuicStream::PendingData::PendingData( | 105 ReliableQuicStream::PendingData::PendingData( |
109 string data_in, scoped_refptr<ProxyAckNotifierDelegate> delegate_in) | 106 string data_in, scoped_refptr<ProxyAckNotifierDelegate> delegate_in) |
110 : data(data_in), delegate(delegate_in) { | 107 : data(data_in), delegate(delegate_in) { |
111 } | 108 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 "422516 ReliableQuicStream::CloseConnection")); | 230 "422516 ReliableQuicStream::CloseConnection")); |
234 | 231 |
235 session()->connection()->SendConnectionClose(error); | 232 session()->connection()->SendConnectionClose(error); |
236 } | 233 } |
237 | 234 |
238 void ReliableQuicStream::CloseConnectionWithDetails(QuicErrorCode error, | 235 void ReliableQuicStream::CloseConnectionWithDetails(QuicErrorCode error, |
239 const string& details) { | 236 const string& details) { |
240 session()->connection()->SendConnectionCloseWithDetails(error, details); | 237 session()->connection()->SendConnectionCloseWithDetails(error, details); |
241 } | 238 } |
242 | 239 |
243 QuicVersion ReliableQuicStream::version() const { | |
244 return session()->connection()->version(); | |
245 } | |
246 | |
247 void ReliableQuicStream::WriteOrBufferData( | 240 void ReliableQuicStream::WriteOrBufferData( |
248 StringPiece data, | 241 StringPiece data, |
249 bool fin, | 242 bool fin, |
250 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { | 243 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { |
251 if (data.empty() && !fin) { | 244 if (data.empty() && !fin) { |
252 LOG(DFATAL) << "data.empty() && !fin"; | 245 LOG(DFATAL) << "data.empty() && !fin"; |
253 return; | 246 return; |
254 } | 247 } |
255 | 248 |
256 if (fin_buffered_) { | 249 if (fin_buffered_) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 connection_flow_controller_->AddBytesConsumed(bytes); | 495 connection_flow_controller_->AddBytesConsumed(bytes); |
503 } | 496 } |
504 } | 497 } |
505 | 498 |
506 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { | 499 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { |
507 if (flow_controller_.UpdateSendWindowOffset(new_window)) { | 500 if (flow_controller_.UpdateSendWindowOffset(new_window)) { |
508 OnCanWrite(); | 501 OnCanWrite(); |
509 } | 502 } |
510 } | 503 } |
511 | 504 |
512 bool ReliableQuicStream::IsFlowControlBlocked() { | |
513 if (flow_controller_.IsBlocked()) { | |
514 return true; | |
515 } | |
516 return stream_contributes_to_connection_flow_control_ && | |
517 connection_flow_controller_->IsBlocked(); | |
518 } | |
519 | |
520 } // namespace net | 505 } // namespace net |
OLD | NEW |