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 "net/quic/iovector.h" | 8 #include "net/quic/iovector.h" |
9 #include "net/quic/quic_flow_controller.h" | 9 #include "net/quic/quic_flow_controller.h" |
10 #include "net/quic/quic_session.h" | 10 #include "net/quic/quic_session.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 num_original_bytes_(0), | 74 num_original_bytes_(0), |
75 num_retransmitted_packets_(0), | 75 num_retransmitted_packets_(0), |
76 num_retransmitted_bytes_(0) { | 76 num_retransmitted_bytes_(0) { |
77 } | 77 } |
78 | 78 |
79 virtual void OnAckNotification(int num_original_packets, | 79 virtual void OnAckNotification(int num_original_packets, |
80 int num_original_bytes, | 80 int num_original_bytes, |
81 int num_retransmitted_packets, | 81 int num_retransmitted_packets, |
82 int num_retransmitted_bytes, | 82 int num_retransmitted_bytes, |
83 QuicTime::Delta delta_largest_observed) | 83 QuicTime::Delta delta_largest_observed) |
84 OVERRIDE { | 84 override { |
85 DCHECK_LT(0, pending_acks_); | 85 DCHECK_LT(0, pending_acks_); |
86 --pending_acks_; | 86 --pending_acks_; |
87 num_original_packets_ += num_original_packets; | 87 num_original_packets_ += num_original_packets; |
88 num_original_bytes_ += num_original_bytes; | 88 num_original_bytes_ += num_original_bytes; |
89 num_retransmitted_packets_ += num_retransmitted_packets; | 89 num_retransmitted_packets_ += num_retransmitted_packets; |
90 num_retransmitted_bytes_ += num_retransmitted_bytes; | 90 num_retransmitted_bytes_ += num_retransmitted_bytes; |
91 | 91 |
92 if (wrote_last_data_ && pending_acks_ == 0) { | 92 if (wrote_last_data_ && pending_acks_ == 0) { |
93 delegate_->OnAckNotification(num_original_packets_, | 93 delegate_->OnAckNotification(num_original_packets_, |
94 num_original_bytes_, | 94 num_original_bytes_, |
95 num_retransmitted_packets_, | 95 num_retransmitted_packets_, |
96 num_retransmitted_bytes_, | 96 num_retransmitted_bytes_, |
97 delta_largest_observed); | 97 delta_largest_observed); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 void WroteData(bool last_data) { | 101 void WroteData(bool last_data) { |
102 DCHECK(!wrote_last_data_); | 102 DCHECK(!wrote_last_data_); |
103 ++pending_acks_; | 103 ++pending_acks_; |
104 wrote_last_data_ = last_data; | 104 wrote_last_data_ = last_data; |
105 } | 105 } |
106 | 106 |
107 protected: | 107 protected: |
108 // Delegates are ref counted. | 108 // Delegates are ref counted. |
109 virtual ~ProxyAckNotifierDelegate() OVERRIDE { | 109 virtual ~ProxyAckNotifierDelegate() override { |
110 } | 110 } |
111 | 111 |
112 private: | 112 private: |
113 // Original delegate. delegate_->OnAckNotification will be called when: | 113 // Original delegate. delegate_->OnAckNotification will be called when: |
114 // wrote_last_data_ == true and pending_acks_ == 0 | 114 // wrote_last_data_ == true and pending_acks_ == 0 |
115 scoped_refptr<DelegateInterface> delegate_; | 115 scoped_refptr<DelegateInterface> delegate_; |
116 | 116 |
117 // Number of outstanding acks. | 117 // Number of outstanding acks. |
118 int pending_acks_; | 118 int pending_acks_; |
119 | 119 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 bool ReliableQuicStream::IsFlowControlBlocked() { | 536 bool ReliableQuicStream::IsFlowControlBlocked() { |
537 if (flow_controller_.IsBlocked()) { | 537 if (flow_controller_.IsBlocked()) { |
538 return true; | 538 return true; |
539 } | 539 } |
540 return stream_contributes_to_connection_flow_control_ && | 540 return stream_contributes_to_connection_flow_control_ && |
541 connection_flow_controller_->IsBlocked(); | 541 connection_flow_controller_->IsBlocked(); |
542 } | 542 } |
543 | 543 |
544 } // namespace net | 544 } // namespace net |
OLD | NEW |