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 #include "net/quic/quic_flow_controller.h" | 5 #include "net/quic/quic_flow_controller.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 void QuicFlowController::Disable() { | 177 void QuicFlowController::Disable() { |
178 is_enabled_ = false; | 178 is_enabled_ = false; |
179 } | 179 } |
180 | 180 |
181 bool QuicFlowController::IsEnabled() const { | 181 bool QuicFlowController::IsEnabled() const { |
182 bool connection_flow_control_enabled = | 182 bool connection_flow_control_enabled = |
183 (id_ == kConnectionLevelId && | 183 (id_ == kConnectionLevelId && |
184 FLAGS_enable_quic_connection_flow_control); | 184 FLAGS_enable_quic_connection_flow_control_2); |
185 bool stream_flow_control_enabled = | 185 bool stream_flow_control_enabled = |
186 (id_ != kConnectionLevelId && | 186 (id_ != kConnectionLevelId && |
187 FLAGS_enable_quic_stream_flow_control_2); | 187 FLAGS_enable_quic_stream_flow_control_2); |
188 return (connection_flow_control_enabled || stream_flow_control_enabled) && | 188 return (connection_flow_control_enabled || stream_flow_control_enabled) && |
189 is_enabled_; | 189 is_enabled_; |
190 } | 190 } |
191 | 191 |
192 bool QuicFlowController::IsBlocked() const { | 192 bool QuicFlowController::IsBlocked() const { |
193 return IsEnabled() && SendWindowSize() == 0; | 193 return IsEnabled() && SendWindowSize() == 0; |
194 } | 194 } |
195 | 195 |
196 uint64 QuicFlowController::SendWindowSize() const { | 196 uint64 QuicFlowController::SendWindowSize() const { |
197 if (bytes_sent_ > send_window_offset_) { | 197 if (bytes_sent_ > send_window_offset_) { |
198 return 0; | 198 return 0; |
199 } | 199 } |
200 return send_window_offset_ - bytes_sent_; | 200 return send_window_offset_ - bytes_sent_; |
201 } | 201 } |
202 | 202 |
203 } // namespace net | 203 } // namespace net |
OLD | NEW |