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

Unified Diff: net/quic/core/congestion_control/pacing_sender.h

Issue 2228783004: Fix memory corruption from SetMaxPacingRate by inlining PacingSender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129351671
Patch Set: git pull from upper stream Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/core/congestion_control/pacing_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/congestion_control/pacing_sender.h
diff --git a/net/quic/core/congestion_control/pacing_sender.h b/net/quic/core/congestion_control/pacing_sender.h
index 98c27da28891ee854b544fa7e9fa643475f050a0..93498719a49164f2178e81650d1fcaa1fdc28733 100644
--- a/net/quic/core/congestion_control/pacing_sender.h
+++ b/net/quic/core/congestion_control/pacing_sender.h
@@ -25,58 +25,37 @@
namespace net {
-class NET_EXPORT_PRIVATE PacingSender : public SendAlgorithmInterface {
+class NET_EXPORT_PRIVATE PacingSender {
public:
- // Create a PacingSender to wrap the specified sender. |alarm_granularity|
- // indicates to the pacer to send that far into the future, since it should
- // not expect a callback before that time delta. |initial_packet_burst| is
- // the number of packets sent without pacing after quiescence.
- PacingSender(SendAlgorithmInterface* sender,
- QuicTime::Delta alarm_granularity,
- uint32_t initial_packet_burst);
- ~PacingSender() override;
+ PacingSender();
+ ~PacingSender();
- void SetMaxPacingRate(QuicBandwidth max_pacing_rate);
+ // Sets the underlying sender. Does not take ownership of |sender|. |sender|
+ // must not be null. This must be called before any of the
+ // SendAlgorithmInterface wrapper methods are called.
+ void set_sender(SendAlgorithmInterface* sender);
- // SendAlgorithmInterface methods.
- void SetFromConfig(const QuicConfig& config,
- Perspective perspective) override;
- void ResumeConnectionState(
- const CachedNetworkParameters& cached_network_params,
- bool max_bandwidth_resumption) override;
- void SetNumEmulatedConnections(int num_connections) override;
- void OnCongestionEvent(bool rtt_updated,
- QuicByteCount bytes_in_flight,
- const CongestionVector& acked_packets,
- const CongestionVector& lost_packets) override;
+ void set_max_pacing_rate(QuicBandwidth max_pacing_rate) {
+ max_pacing_rate_ = max_pacing_rate;
+ }
+
+ void OnCongestionEvent(
+ bool rtt_updated,
+ QuicByteCount bytes_in_flight,
+ const SendAlgorithmInterface::CongestionVector& acked_packets,
+ const SendAlgorithmInterface::CongestionVector& lost_packets);
bool OnPacketSent(QuicTime sent_time,
QuicByteCount bytes_in_flight,
QuicPacketNumber packet_number,
QuicByteCount bytes,
- HasRetransmittableData is_retransmittable) override;
- void OnRetransmissionTimeout(bool packets_retransmitted) override;
- void OnConnectionMigration() override;
+ HasRetransmittableData is_retransmittable);
QuicTime::Delta TimeUntilSend(QuicTime now,
- QuicByteCount bytes_in_flight) const override;
- QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const override;
- QuicBandwidth BandwidthEstimate() const override;
- QuicTime::Delta RetransmissionDelay() const override;
- QuicByteCount GetCongestionWindow() const override;
- bool InSlowStart() const override;
- bool InRecovery() const override;
- QuicByteCount GetSlowStartThreshold() const override;
- CongestionControlType GetCongestionControlType() const override;
- std::string GetDebugState() const override;
- void OnApplicationLimited(QuicByteCount bytes_in_flight) override;
- // End implementation of SendAlgorithmInterface.
+ QuicByteCount bytes_in_flight) const;
+ QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const;
private:
- std::unique_ptr<SendAlgorithmInterface> sender_; // Underlying sender.
- // The estimated system alarm granularity.
- const QuicTime::Delta alarm_granularity_;
- // Configured maximum size of the burst coming out of quiescence. The burst
- // is never larger than the current CWND in packets.
- const uint32_t initial_packet_burst_;
+ // Underlying sender. Not owned.
+ SendAlgorithmInterface* sender_;
// If not QuicBandidth::Zero, the maximum rate the PacingSender will use.
QuicBandwidth max_pacing_rate_;
« no previous file with comments | « no previous file | net/quic/core/congestion_control/pacing_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698