gfe-relnote: (n/a) Remove some unnecessary dynamic_casts from QUIC. No behavior change, not protected.
PiperOrigin-RevId: 241741824
Change-Id: Icb921e0f4e51a05da88a3149713683729b67afdd
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 89757de..f227190 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -84,11 +84,7 @@
debug_delegate_(nullptr),
network_change_visitor_(nullptr),
initial_congestion_window_(kInitialCongestionWindow),
- loss_algorithm_(
- unacked_packets_.use_uber_loss_algorithm()
- ? dynamic_cast<LossDetectionInterface*>(&uber_loss_algorithm_)
- : dynamic_cast<LossDetectionInterface*>(
- &general_loss_algorithm_)),
+ loss_algorithm_(GetInitialLossAlgorithm()),
general_loss_algorithm_(loss_type),
uber_loss_algorithm_(loss_type),
consecutive_rto_count_(0),
@@ -120,6 +116,13 @@
SetSendAlgorithm(congestion_control_type);
}
+LossDetectionInterface* QuicSentPacketManager::GetInitialLossAlgorithm() {
+ if (unacked_packets_.use_uber_loss_algorithm()) {
+ return &uber_loss_algorithm_;
+ }
+ return &general_loss_algorithm_;
+}
+
QuicSentPacketManager::~QuicSentPacketManager() {}
void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {