| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 QuicSentPacketManager::~QuicSentPacketManager() { | 78 QuicSentPacketManager::~QuicSentPacketManager() { |
| 79 } | 79 } |
| 80 | 80 |
| 81 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { | 81 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
| 82 if (config.HasReceivedInitialRoundTripTimeUs() && | 82 if (config.HasReceivedInitialRoundTripTimeUs() && |
| 83 config.ReceivedInitialRoundTripTimeUs() > 0) { | 83 config.ReceivedInitialRoundTripTimeUs() > 0) { |
| 84 rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs, | 84 rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs, |
| 85 config.ReceivedInitialRoundTripTimeUs())); | 85 config.ReceivedInitialRoundTripTimeUs())); |
| 86 } | 86 } |
| 87 // TODO(ianswett): BBR is currently a server only feature. | 87 // TODO(ianswett): BBR is currently a server only feature. |
| 88 if (config.HasReceivedCongestionOptions() && | 88 if (config.HasReceivedConnectionOptions() && |
| 89 ContainsQuicTag(config.ReceivedCongestionOptions(), kTBBR)) { | 89 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { |
| 90 send_algorithm_.reset( | 90 send_algorithm_.reset( |
| 91 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kTCPBBR, stats_)); | 91 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kTCPBBR, stats_)); |
| 92 } | 92 } |
| 93 if (config.congestion_feedback() == kPACE || | 93 if (config.congestion_feedback() == kPACE || |
| 94 (config.HasReceivedCongestionOptions() && | 94 (config.HasReceivedConnectionOptions() && |
| 95 ContainsQuicTag(config.ReceivedCongestionOptions(), kPACE))) { | 95 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE))) { |
| 96 MaybeEnablePacing(); | 96 MaybeEnablePacing(); |
| 97 } | 97 } |
| 98 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once | 98 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once |
| 99 // the CongestionOptions code is live everywhere. | 99 // the ConnectionOptions code is live everywhere. |
| 100 if ((config.HasReceivedLossDetection() && | 100 if ((config.HasReceivedLossDetection() && |
| 101 config.ReceivedLossDetection() == kTIME) || | 101 config.ReceivedLossDetection() == kTIME) || |
| 102 (config.HasReceivedCongestionOptions() && | 102 (config.HasReceivedConnectionOptions() && |
| 103 ContainsQuicTag(config.ReceivedCongestionOptions(), kTIME))) { | 103 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME))) { |
| 104 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); | 104 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); |
| 105 } | 105 } |
| 106 send_algorithm_->SetFromConfig(config, is_server_); | 106 send_algorithm_->SetFromConfig(config, is_server_); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // TODO(ianswett): Combine this method with OnPacketSent once packets are always | 109 // TODO(ianswett): Combine this method with OnPacketSent once packets are always |
| 110 // sent in order and the connection tracks RetransmittableFrames for longer. | 110 // sent in order and the connection tracks RetransmittableFrames for longer. |
| 111 void QuicSentPacketManager::OnSerializedPacket( | 111 void QuicSentPacketManager::OnSerializedPacket( |
| 112 const SerializedPacket& serialized_packet) { | 112 const SerializedPacket& serialized_packet) { |
| 113 if (serialized_packet.retransmittable_frames) { | 113 if (serialized_packet.retransmittable_frames) { |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 } | 782 } |
| 783 | 783 |
| 784 // Set up a pacing sender with a 5 millisecond alarm granularity. | 784 // Set up a pacing sender with a 5 millisecond alarm granularity. |
| 785 using_pacing_ = true; | 785 using_pacing_ = true; |
| 786 send_algorithm_.reset( | 786 send_algorithm_.reset( |
| 787 new PacingSender(send_algorithm_.release(), | 787 new PacingSender(send_algorithm_.release(), |
| 788 QuicTime::Delta::FromMilliseconds(5))); | 788 QuicTime::Delta::FromMilliseconds(5))); |
| 789 } | 789 } |
| 790 | 790 |
| 791 } // namespace net | 791 } // namespace net |
| OLD | NEW |