| 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_QUIC_FLOW_CONTROLLER_H_ | 5 #ifndef NET_QUIC_QUIC_FLOW_CONTROLLER_H_ |
| 6 #define NET_QUIC_QUIC_FLOW_CONTROLLER_H_ | 6 #define NET_QUIC_QUIC_FLOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Set a new send window offset. | 49 // Set a new send window offset. |
| 50 // Returns true if this increases send_window_offset_ and is now blocked. | 50 // Returns true if this increases send_window_offset_ and is now blocked. |
| 51 bool UpdateSendWindowOffset(QuicStreamOffset new_send_window_offset); | 51 bool UpdateSendWindowOffset(QuicStreamOffset new_send_window_offset); |
| 52 | 52 |
| 53 // Returns the current available send window. | 53 // Returns the current available send window. |
| 54 QuicByteCount SendWindowSize() const; | 54 QuicByteCount SendWindowSize() const; |
| 55 | 55 |
| 56 // Send a BLOCKED frame if appropriate. | 56 // Send a BLOCKED frame if appropriate. |
| 57 void MaybeSendBlocked(); | 57 void MaybeSendBlocked(); |
| 58 | 58 |
| 59 // Disable flow control. | |
| 60 void Disable(); | |
| 61 | |
| 62 // Returns true if flow control is enabled. | |
| 63 bool IsEnabled() const; | |
| 64 | |
| 65 // Returns true if flow control send limits have been reached. | 59 // Returns true if flow control send limits have been reached. |
| 66 bool IsBlocked() const; | 60 bool IsBlocked() const; |
| 67 | 61 |
| 68 // Returns true if flow control receive limits have been violated by the peer. | 62 // Returns true if flow control receive limits have been violated by the peer. |
| 69 bool FlowControlViolation(); | 63 bool FlowControlViolation(); |
| 70 | 64 |
| 71 QuicByteCount bytes_consumed() const { return bytes_consumed_; } | 65 QuicByteCount bytes_consumed() const { return bytes_consumed_; } |
| 72 | 66 |
| 73 QuicStreamOffset highest_received_byte_offset() const { | 67 QuicStreamOffset highest_received_byte_offset() const { |
| 74 return highest_received_byte_offset_; | 68 return highest_received_byte_offset_; |
| 75 } | 69 } |
| 76 | 70 |
| 77 private: | 71 private: |
| 78 friend class test::QuicFlowControllerPeer; | 72 friend class test::QuicFlowControllerPeer; |
| 79 | 73 |
| 80 // Send a WINDOW_UPDATE frame if appropriate. | 74 // Send a WINDOW_UPDATE frame if appropriate. |
| 81 void MaybeSendWindowUpdate(); | 75 void MaybeSendWindowUpdate(); |
| 82 | 76 |
| 83 // The parent connection, used to send connection close on flow control | 77 // The parent connection, used to send connection close on flow control |
| 84 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate. | 78 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate. |
| 85 // Not owned. | 79 // Not owned. |
| 86 QuicConnection* connection_; | 80 QuicConnection* connection_; |
| 87 | 81 |
| 88 // ID of stream this flow controller belongs to. This can be 0 if this is a | 82 // ID of stream this flow controller belongs to. This can be 0 if this is a |
| 89 // connection level flow controller. | 83 // connection level flow controller. |
| 90 QuicStreamId id_; | 84 QuicStreamId id_; |
| 91 | 85 |
| 92 // True if flow control is enabled. | |
| 93 bool is_enabled_; | |
| 94 | |
| 95 // True if this is owned by a server. | 86 // True if this is owned by a server. |
| 96 bool is_server_; | 87 bool is_server_; |
| 97 | 88 |
| 98 // Track number of bytes received from the peer, which have been consumed | 89 // Track number of bytes received from the peer, which have been consumed |
| 99 // locally. | 90 // locally. |
| 100 QuicByteCount bytes_consumed_; | 91 QuicByteCount bytes_consumed_; |
| 101 | 92 |
| 102 // The highest byte offset we have seen from the peer. This could be the | 93 // The highest byte offset we have seen from the peer. This could be the |
| 103 // highest offset in a data frame, or a final value in a RST. | 94 // highest offset in a data frame, or a final value in a RST. |
| 104 QuicStreamOffset highest_received_byte_offset_; | 95 QuicStreamOffset highest_received_byte_offset_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 120 // Keep track of the last time we sent a BLOCKED frame. We should only send | 111 // Keep track of the last time we sent a BLOCKED frame. We should only send |
| 121 // another when the number of bytes we have sent has changed. | 112 // another when the number of bytes we have sent has changed. |
| 122 QuicStreamOffset last_blocked_send_window_offset_; | 113 QuicStreamOffset last_blocked_send_window_offset_; |
| 123 | 114 |
| 124 DISALLOW_COPY_AND_ASSIGN(QuicFlowController); | 115 DISALLOW_COPY_AND_ASSIGN(QuicFlowController); |
| 125 }; | 116 }; |
| 126 | 117 |
| 127 } // namespace net | 118 } // namespace net |
| 128 | 119 |
| 129 #endif // NET_QUIC_QUIC_FLOW_CONTROLLER_H_ | 120 #endif // NET_QUIC_QUIC_FLOW_CONTROLLER_H_ |
| OLD | NEW |