| 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 #include "net/quic/congestion_control/quic_congestion_manager.h" | 5 #include "net/quic/congestion_control/quic_congestion_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 const QuicTime::Delta QuicCongestionManager::SmoothedRtt() { | 210 const QuicTime::Delta QuicCongestionManager::SmoothedRtt() { |
| 211 return send_algorithm_->SmoothedRtt(); | 211 return send_algorithm_->SmoothedRtt(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 QuicBandwidth QuicCongestionManager::BandwidthEstimate() { | 214 QuicBandwidth QuicCongestionManager::BandwidthEstimate() { |
| 215 return send_algorithm_->BandwidthEstimate(); | 215 return send_algorithm_->BandwidthEstimate(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 QuicByteCount QuicCongestionManager::GetCongestionWindow() { |
| 219 return send_algorithm_->GetCongestionWindow(); |
| 220 } |
| 221 |
| 222 void QuicCongestionManager::SetCongestionWindow(QuicByteCount window) { |
| 223 send_algorithm_->SetCongestionWindow(window); |
| 224 } |
| 225 |
| 218 void QuicCongestionManager::CleanupPacketHistory() { | 226 void QuicCongestionManager::CleanupPacketHistory() { |
| 219 const QuicTime::Delta kHistoryPeriod = | 227 const QuicTime::Delta kHistoryPeriod = |
| 220 QuicTime::Delta::FromMilliseconds(kHistoryPeriodMs); | 228 QuicTime::Delta::FromMilliseconds(kHistoryPeriodMs); |
| 221 QuicTime now = clock_->ApproximateNow(); | 229 QuicTime now = clock_->ApproximateNow(); |
| 222 | 230 |
| 223 SendAlgorithmInterface::SentPacketsMap::iterator history_it = | 231 SendAlgorithmInterface::SentPacketsMap::iterator history_it = |
| 224 packet_history_map_.begin(); | 232 packet_history_map_.begin(); |
| 225 for (; history_it != packet_history_map_.end(); ++history_it) { | 233 for (; history_it != packet_history_map_.end(); ++history_it) { |
| 226 if (now.Subtract(history_it->second->SendTimestamp()) <= kHistoryPeriod) { | 234 if (now.Subtract(history_it->second->SendTimestamp()) <= kHistoryPeriod) { |
| 227 return; | 235 return; |
| 228 } | 236 } |
| 229 delete history_it->second; | 237 delete history_it->second; |
| 230 packet_history_map_.erase(history_it); | 238 packet_history_map_.erase(history_it); |
| 231 history_it = packet_history_map_.begin(); | 239 history_it = packet_history_map_.begin(); |
| 232 } | 240 } |
| 233 } | 241 } |
| 234 | 242 |
| 235 } // namespace net | 243 } // namespace net |
| OLD | NEW |