| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 send_window_offset_ = new_send_window_offset; | 173 send_window_offset_ = new_send_window_offset; |
| 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 return is_enabled_; |
| 183 (id_ == kConnectionLevelId && | |
| 184 FLAGS_enable_quic_connection_flow_control_2); | |
| 185 bool stream_flow_control_enabled = (id_ != kConnectionLevelId); | |
| 186 return (connection_flow_control_enabled || stream_flow_control_enabled) && | |
| 187 is_enabled_; | |
| 188 } | 183 } |
| 189 | 184 |
| 190 bool QuicFlowController::IsBlocked() const { | 185 bool QuicFlowController::IsBlocked() const { |
| 191 return IsEnabled() && SendWindowSize() == 0; | 186 return IsEnabled() && SendWindowSize() == 0; |
| 192 } | 187 } |
| 193 | 188 |
| 194 uint64 QuicFlowController::SendWindowSize() const { | 189 uint64 QuicFlowController::SendWindowSize() const { |
| 195 if (bytes_sent_ > send_window_offset_) { | 190 if (bytes_sent_ > send_window_offset_) { |
| 196 return 0; | 191 return 0; |
| 197 } | 192 } |
| 198 return send_window_offset_ - bytes_sent_; | 193 return send_window_offset_ - bytes_sent_; |
| 199 } | 194 } |
| 200 | 195 |
| 201 } // namespace net | 196 } // namespace net |
| OLD | NEW |