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 // The base class for client/server reliable streams. | 5 // The base class for client/server reliable streams. |
6 | 6 |
7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
9 | 9 |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Adjust our flow control windows according to new offset in |frame|. | 92 // Adjust our flow control windows according to new offset in |frame|. |
93 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); | 93 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); |
94 | 94 |
95 int num_frames_received() const; | 95 int num_frames_received() const; |
96 | 96 |
97 int num_duplicate_frames_received() const; | 97 int num_duplicate_frames_received() const; |
98 | 98 |
99 QuicFlowController* flow_controller() { return &flow_controller_; } | 99 QuicFlowController* flow_controller() { return &flow_controller_; } |
100 | 100 |
101 // Called by the stream sequencer as bytes are added to the buffer. | 101 // Called when we see a frame which could increase the highest offset. |
102 void AddBytesBuffered(uint64 bytes); | 102 void MaybeIncreaseHighestReceivedOffset(uint64 new_offset); |
103 // Called by the stream sequencer as bytes are removed from the buffer. | 103 // Called when bytese are sent to the peer. |
104 void RemoveBytesBuffered(uint64 bytes); | |
105 // Called when bytes are sent to the peer. | |
106 void AddBytesSent(uint64 bytes); | 104 void AddBytesSent(uint64 bytes); |
107 // Called by the stream sequencer as bytes are consumed from the buffer. | 105 // Called by the stream sequencer as bytes are consumed from the buffer. |
108 // If our receive window has dropped below the threshold, then send a | 106 // If our receive window has dropped below the threshold, then send a |
109 // WINDOW_UPDATE frame. | 107 // WINDOW_UPDATE frame. |
110 void AddBytesConsumed(uint64 bytes); | 108 void AddBytesConsumed(uint64 bytes); |
111 | 109 |
112 // Returns true if the stream is flow control blocked, by the stream flow | 110 // Returns true if the stream is flow control blocked, by the stream flow |
113 // control window or the connection flow control window. | 111 // control window or the connection flow control window. |
114 bool IsFlowControlBlocked(); | 112 bool IsFlowControlBlocked(); |
115 | 113 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 PendingData(string data_in, | 159 PendingData(string data_in, |
162 scoped_refptr<ProxyAckNotifierDelegate> delegate_in); | 160 scoped_refptr<ProxyAckNotifierDelegate> delegate_in); |
163 ~PendingData(); | 161 ~PendingData(); |
164 | 162 |
165 string data; | 163 string data; |
166 // Delegate that should be notified when the pending data is acked. | 164 // Delegate that should be notified when the pending data is acked. |
167 // Can be nullptr. | 165 // Can be nullptr. |
168 scoped_refptr<ProxyAckNotifierDelegate> delegate; | 166 scoped_refptr<ProxyAckNotifierDelegate> delegate; |
169 }; | 167 }; |
170 | 168 |
171 // Calculates and returns available flow control send window. | |
172 uint64 SendWindowSize() const; | |
173 | |
174 // Calculates and returns total number of bytes this stream has received. | |
175 uint64 TotalReceivedBytes() const; | |
176 | |
177 // Calls MaybeSendBlocked on our flow controller, and connection level flow | 169 // Calls MaybeSendBlocked on our flow controller, and connection level flow |
178 // controller. If we are flow control blocked, marks this stream as write | 170 // controller. If we are flow control blocked, marks this stream as write |
179 // blocked. | 171 // blocked. |
180 void MaybeSendBlocked(); | 172 void MaybeSendBlocked(); |
181 | 173 |
182 std::list<PendingData> queued_data_; | 174 std::list<PendingData> queued_data_; |
183 | 175 |
184 QuicStreamSequencer sequencer_; | 176 QuicStreamSequencer sequencer_; |
185 QuicStreamId id_; | 177 QuicStreamId id_; |
186 QuicSession* session_; | 178 QuicSession* session_; |
(...skipping 29 matching lines...) Expand all Loading... |
216 | 208 |
217 // The connection level flow controller. Not owned. | 209 // The connection level flow controller. Not owned. |
218 QuicFlowController* connection_flow_controller_; | 210 QuicFlowController* connection_flow_controller_; |
219 | 211 |
220 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 212 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
221 }; | 213 }; |
222 | 214 |
223 } // namespace net | 215 } // namespace net |
224 | 216 |
225 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 217 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |