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

Unified Diff: net/quic/congestion_control/pacing_sender.cc

Issue 2125303002: Use overloaded operators with QuicTime for addition, subtraction and scalar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126402784
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/hybrid_slow_start_test.cc ('k') | net/quic/congestion_control/rtt_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/pacing_sender.cc
diff --git a/net/quic/congestion_control/pacing_sender.cc b/net/quic/congestion_control/pacing_sender.cc
index 0f0ef3af5ebf096077f091b3a4846d677a0f9a11..7f366c93cd1d75d955f680c9f88d8b18150bfc59 100644
--- a/net/quic/congestion_control/pacing_sender.cc
+++ b/net/quic/congestion_control/pacing_sender.cc
@@ -91,12 +91,12 @@ bool PacingSender::OnPacketSent(
// If the last send was delayed, and the alarm took a long time to get
// invoked, allow the connection to make up for lost time.
if (was_last_send_delayed_) {
- ideal_next_packet_send_time_ = ideal_next_packet_send_time_.Add(delay);
+ ideal_next_packet_send_time_ = ideal_next_packet_send_time_ + delay;
// The send was application limited if it takes longer than the
// pacing delay between sent packets.
const bool application_limited =
last_delayed_packet_sent_time_.IsInitialized() &&
- sent_time > last_delayed_packet_sent_time_.Add(delay);
+ sent_time > last_delayed_packet_sent_time_ + delay;
const bool making_up_for_lost_time =
ideal_next_packet_send_time_ <= sent_time;
// As long as we're making up time and not application limited,
@@ -109,8 +109,8 @@ bool PacingSender::OnPacketSent(
last_delayed_packet_sent_time_ = QuicTime::Zero();
}
} else {
- ideal_next_packet_send_time_ = QuicTime::Max(
- ideal_next_packet_send_time_.Add(delay), sent_time.Add(delay));
+ ideal_next_packet_send_time_ =
+ QuicTime::Max(ideal_next_packet_send_time_ + delay, sent_time + delay);
}
return in_flight;
}
@@ -140,11 +140,11 @@ QuicTime::Delta PacingSender::TimeUntilSend(
}
// If the next send time is within the alarm granularity, send immediately.
- if (ideal_next_packet_send_time_ > now.Add(alarm_granularity_)) {
+ if (ideal_next_packet_send_time_ > now + alarm_granularity_) {
DVLOG(1) << "Delaying packet: "
- << ideal_next_packet_send_time_.Subtract(now).ToMicroseconds();
+ << (ideal_next_packet_send_time_ - now).ToMicroseconds();
was_last_send_delayed_ = true;
- return ideal_next_packet_send_time_.Subtract(now);
+ return ideal_next_packet_send_time_ - now;
}
DVLOG(1) << "Sending packet now";
« no previous file with comments | « net/quic/congestion_control/hybrid_slow_start_test.cc ('k') | net/quic/congestion_control/rtt_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698