| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ |
| 6 #define NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ | 6 #define NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "net/quic/core/quic_packets.h" | 9 #include "net/quic/core/quic_packets.h" |
| 10 #include "net/quic/platform/api/quic_export.h" | 10 #include "net/quic/platform/api/quic_export.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Send a BLOCKED frame if appropriate. | 77 // Send a BLOCKED frame if appropriate. |
| 78 void MaybeSendBlocked(); | 78 void MaybeSendBlocked(); |
| 79 | 79 |
| 80 // Returns true if flow control send limits have been reached. | 80 // Returns true if flow control send limits have been reached. |
| 81 bool IsBlocked() const; | 81 bool IsBlocked() const; |
| 82 | 82 |
| 83 // Returns true if flow control receive limits have been violated by the peer. | 83 // Returns true if flow control receive limits have been violated by the peer. |
| 84 bool FlowControlViolation(); | 84 bool FlowControlViolation(); |
| 85 | 85 |
| 86 // Inform the peer of new receive window. |
| 87 void SendWindowUpdate(); |
| 88 |
| 86 QuicByteCount bytes_consumed() const { return bytes_consumed_; } | 89 QuicByteCount bytes_consumed() const { return bytes_consumed_; } |
| 87 | 90 |
| 88 QuicStreamOffset highest_received_byte_offset() const { | 91 QuicStreamOffset highest_received_byte_offset() const { |
| 89 return highest_received_byte_offset_; | 92 return highest_received_byte_offset_; |
| 90 } | 93 } |
| 91 | 94 |
| 92 void set_receive_window_size_limit(QuicByteCount receive_window_size_limit) { | 95 void set_receive_window_size_limit(QuicByteCount receive_window_size_limit) { |
| 93 DCHECK_GE(receive_window_size_limit, receive_window_size_limit_); | 96 DCHECK_GE(receive_window_size_limit, receive_window_size_limit_); |
| 94 receive_window_size_limit_ = receive_window_size_limit; | 97 receive_window_size_limit_ = receive_window_size_limit; |
| 95 } | 98 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 106 private: | 109 private: |
| 107 friend class test::QuicFlowControllerPeer; | 110 friend class test::QuicFlowControllerPeer; |
| 108 | 111 |
| 109 // Send a WINDOW_UPDATE frame if appropriate. | 112 // Send a WINDOW_UPDATE frame if appropriate. |
| 110 void MaybeSendWindowUpdate(); | 113 void MaybeSendWindowUpdate(); |
| 111 | 114 |
| 112 // Auto-tune the max receive window size. | 115 // Auto-tune the max receive window size. |
| 113 void MaybeIncreaseMaxWindowSize(); | 116 void MaybeIncreaseMaxWindowSize(); |
| 114 | 117 |
| 115 // Updates the current offset and sends a window update frame. | 118 // Updates the current offset and sends a window update frame. |
| 116 void SendWindowUpdate(QuicStreamOffset available_window); | 119 void UpdateReceiveWindowOffsetAndSendWindowUpdate( |
| 120 QuicStreamOffset available_window); |
| 117 | 121 |
| 118 // Double the window size as long as we haven't hit the max window size. | 122 // Double the window size as long as we haven't hit the max window size. |
| 119 void IncreaseWindowSize(); | 123 void IncreaseWindowSize(); |
| 120 | 124 |
| 121 // The parent connection, used to send connection close on flow control | 125 // The parent connection, used to send connection close on flow control |
| 122 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate. | 126 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate. |
| 123 // Not owned. | 127 // Not owned. |
| 124 QuicConnection* connection_; | 128 QuicConnection* connection_; |
| 125 | 129 |
| 126 // ID of stream this flow controller belongs to. This can be 0 if this is a | 130 // ID of stream this flow controller belongs to. This can be 0 if this is a |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Keep time of the last time a window update was sent. We use this | 196 // Keep time of the last time a window update was sent. We use this |
| 193 // as part of the receive window auto tuning. | 197 // as part of the receive window auto tuning. |
| 194 QuicTime prev_window_update_time_; | 198 QuicTime prev_window_update_time_; |
| 195 | 199 |
| 196 DISALLOW_COPY_AND_ASSIGN(QuicFlowController); | 200 DISALLOW_COPY_AND_ASSIGN(QuicFlowController); |
| 197 }; | 201 }; |
| 198 | 202 |
| 199 } // namespace net | 203 } // namespace net |
| 200 | 204 |
| 201 #endif // NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ | 205 #endif // NET_QUIC_CORE_QUIC_FLOW_CONTROLLER_H_ |
| OLD | NEW |