Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: net/quic/quic_sent_packet_manager.cc

Issue 400813002: Cleanup and adding GetCongestionControlType. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return false; 56 return false;
57 } 57 }
58 return transmission_info.retransmittable_frames->HasCryptoHandshake() == 58 return transmission_info.retransmittable_frames->HasCryptoHandshake() ==
59 IS_HANDSHAKE; 59 IS_HANDSHAKE;
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") 64 #define ENDPOINT (is_server_ ? "Server: " : " Client: ")
65 65
66 QuicSentPacketManager::QuicSentPacketManager(bool is_server, 66 QuicSentPacketManager::QuicSentPacketManager(
67 const QuicClock* clock, 67 bool is_server,
68 QuicConnectionStats* stats, 68 const QuicClock* clock,
69 CongestionFeedbackType type, 69 QuicConnectionStats* stats,
70 LossDetectionType loss_type) 70 CongestionControlType congestion_control_type,
71 LossDetectionType loss_type)
71 : unacked_packets_(), 72 : unacked_packets_(),
72 is_server_(is_server), 73 is_server_(is_server),
73 clock_(clock), 74 clock_(clock),
74 stats_(stats), 75 stats_(stats),
75 debug_delegate_(NULL), 76 debug_delegate_(NULL),
76 network_change_visitor_(NULL), 77 network_change_visitor_(NULL),
77 send_algorithm_( 78 send_algorithm_(SendAlgorithmInterface::Create(clock,
78 SendAlgorithmInterface::Create(clock, &rtt_stats_, type, stats)), 79 &rtt_stats_,
80 congestion_control_type,
81 stats)),
79 loss_algorithm_(LossDetectionInterface::Create(loss_type)), 82 loss_algorithm_(LossDetectionInterface::Create(loss_type)),
80 largest_observed_(0), 83 largest_observed_(0),
81 first_rto_transmission_(0), 84 first_rto_transmission_(0),
82 consecutive_rto_count_(0), 85 consecutive_rto_count_(0),
83 consecutive_tlp_count_(0), 86 consecutive_tlp_count_(0),
84 consecutive_crypto_retransmission_count_(0), 87 consecutive_crypto_retransmission_count_(0),
85 pending_tlp_transmission_(false), 88 pending_tlp_transmission_(false),
86 max_tail_loss_probes_(kDefaultMaxTailLossProbes), 89 max_tail_loss_probes_(kDefaultMaxTailLossProbes),
87 using_pacing_(false) { 90 using_pacing_(false) {
88 } 91 }
89 92
90 QuicSentPacketManager::~QuicSentPacketManager() { 93 QuicSentPacketManager::~QuicSentPacketManager() {
91 } 94 }
92 95
93 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { 96 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
94 if (config.HasReceivedInitialRoundTripTimeUs() && 97 if (config.HasReceivedInitialRoundTripTimeUs() &&
95 config.ReceivedInitialRoundTripTimeUs() > 0) { 98 config.ReceivedInitialRoundTripTimeUs() > 0) {
96 rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs, 99 rtt_stats_.set_initial_rtt_us(min(kMaxInitialRoundTripTimeUs,
97 config.ReceivedInitialRoundTripTimeUs())); 100 config.ReceivedInitialRoundTripTimeUs()));
98 } 101 }
99 // TODO(ianswett): BBR is currently a server only feature. 102 // TODO(ianswett): BBR is currently a server only feature.
100 if (config.HasReceivedConnectionOptions() && 103 if (config.HasReceivedConnectionOptions() &&
101 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { 104 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) {
102 if (FLAGS_quic_recent_min_rtt_window_s > 0) { 105 if (FLAGS_quic_recent_min_rtt_window_s > 0) {
103 rtt_stats_.set_recent_min_rtt_window( 106 rtt_stats_.set_recent_min_rtt_window(
104 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); 107 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s));
105 } 108 }
106 send_algorithm_.reset( 109 send_algorithm_.reset(
107 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kTCPBBR, stats_)); 110 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kBBR, stats_));
108 } 111 }
109 if (config.congestion_feedback() == kPACE || 112 if (config.congestion_feedback() == kPACE ||
110 (config.HasReceivedConnectionOptions() && 113 (config.HasReceivedConnectionOptions() &&
111 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE))) { 114 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE))) {
112 MaybeEnablePacing(); 115 MaybeEnablePacing();
113 } 116 }
114 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once 117 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once
115 // the ConnectionOptions code is live everywhere. 118 // the ConnectionOptions code is live everywhere.
116 if ((config.HasReceivedLossDetection() && 119 if ((config.HasReceivedLossDetection() &&
117 config.ReceivedLossDetection() == kTIME) || 120 config.ReceivedLossDetection() == kTIME) ||
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 858
856 // Set up a pacing sender with a 5 millisecond alarm granularity. 859 // Set up a pacing sender with a 5 millisecond alarm granularity.
857 using_pacing_ = true; 860 using_pacing_ = true;
858 send_algorithm_.reset( 861 send_algorithm_.reset(
859 new PacingSender(send_algorithm_.release(), 862 new PacingSender(send_algorithm_.release(),
860 QuicTime::Delta::FromMilliseconds(5), 863 QuicTime::Delta::FromMilliseconds(5),
861 kInitialUnpacedBurst)); 864 kInitialUnpacedBurst));
862 } 865 }
863 866
864 } // namespace net 867 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698