| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/tcp_cubic_bytes_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 kInitialCongestionWindowPackets * kDefaultTCPMSS; | 27 kInitialCongestionWindowPackets * kDefaultTCPMSS; |
| 28 const float kRenoBeta = 0.7f; // Reno backoff factor. | 28 const float kRenoBeta = 0.7f; // Reno backoff factor. |
| 29 | 29 |
| 30 class TcpCubicBytesSenderPeer : public TcpCubicBytesSender { | 30 class TcpCubicBytesSenderPeer : public TcpCubicBytesSender { |
| 31 public: | 31 public: |
| 32 TcpCubicBytesSenderPeer(const QuicClock* clock, bool reno) | 32 TcpCubicBytesSenderPeer(const QuicClock* clock, bool reno) |
| 33 : TcpCubicBytesSender(clock, | 33 : TcpCubicBytesSender(clock, |
| 34 &rtt_stats_, | 34 &rtt_stats_, |
| 35 reno, | 35 reno, |
| 36 kInitialCongestionWindowPackets, | 36 kInitialCongestionWindowPackets, |
| 37 kMaxTcpCongestionWindow, |
| 37 &stats_) {} | 38 &stats_) {} |
| 38 | 39 |
| 39 const HybridSlowStart& hybrid_slow_start() const { | 40 const HybridSlowStart& hybrid_slow_start() const { |
| 40 return hybrid_slow_start_; | 41 return hybrid_slow_start_; |
| 41 } | 42 } |
| 42 | 43 |
| 43 float GetRenoBeta() const { return RenoBeta(); } | 44 float GetRenoBeta() const { return RenoBeta(); } |
| 44 | 45 |
| 45 RttStats rtt_stats_; | 46 RttStats rtt_stats_; |
| 46 QuicConnectionStats stats_; | 47 QuicConnectionStats stats_; |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 EXPECT_EQ(10u * kDefaultTCPMSS, sender_->GetCongestionWindow()); | 619 EXPECT_EQ(10u * kDefaultTCPMSS, sender_->GetCongestionWindow()); |
| 619 | 620 |
| 620 // If the estimate is new enough, make sure it is used. | 621 // If the estimate is new enough, make sure it is used. |
| 621 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() - | 622 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() - |
| 622 (kNumSecondsPerHour - 1)); | 623 (kNumSecondsPerHour - 1)); |
| 623 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); | 624 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); |
| 624 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow()); | 625 EXPECT_EQ(kNumberOfPackets * kDefaultTCPMSS, sender_->GetCongestionWindow()); |
| 625 | 626 |
| 626 // Resumed CWND is limited to be in a sensible range. | 627 // Resumed CWND is limited to be in a sensible range. |
| 627 cached_network_params.set_bandwidth_estimate_bytes_per_second( | 628 cached_network_params.set_bandwidth_estimate_bytes_per_second( |
| 628 (kMaxCongestionWindowForBandwidthResumption + 1) * kDefaultTCPMSS); | 629 (kMaxTcpCongestionWindow + 1) * kDefaultTCPMSS); |
| 629 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); | 630 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); |
| 630 EXPECT_EQ(kMaxCongestionWindowForBandwidthResumption * kDefaultTCPMSS, | 631 EXPECT_EQ(kMaxTcpCongestionWindow * kDefaultTCPMSS, |
| 631 sender_->GetCongestionWindow()); | 632 sender_->GetCongestionWindow()); |
| 632 | 633 |
| 633 cached_network_params.set_bandwidth_estimate_bytes_per_second( | 634 cached_network_params.set_bandwidth_estimate_bytes_per_second( |
| 634 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS); | 635 (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS); |
| 635 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); | 636 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); |
| 636 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS, | 637 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS, |
| 637 sender_->GetCongestionWindow()); | 638 sender_->GetCongestionWindow()); |
| 638 } | 639 } |
| 639 | 640 |
| 640 } // namespace test | 641 } // namespace test |
| 641 } // namespace net | 642 } // namespace net |
| OLD | NEW |