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

Unified Diff: net/quic/congestion_control/cubic.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 | « no previous file | net/quic/congestion_control/cubic_bytes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/cubic.cc
diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc
index 9a924b5b3ca7811b147d129bfc632d4bc49eead3..ca90d7148e32d12989bf7075ea8b82e732146411 100644
--- a/net/quic/congestion_control/cubic.cc
+++ b/net/quic/congestion_control/cubic.cc
@@ -117,7 +117,7 @@ QuicPacketCount Cubic::CongestionWindowAfterAck(
// Cubic is "independent" of RTT, the update is limited by the time elapsed.
if (last_congestion_window_ == current_congestion_window &&
- (current_time.Subtract(last_update_time_) <= MaxCubicTimeInterval())) {
+ (current_time - last_update_time_ <= MaxCubicTimeInterval())) {
return max(last_target_congestion_window_,
estimated_tcp_congestion_window_);
}
@@ -145,9 +145,9 @@ QuicPacketCount Cubic::CongestionWindowAfterAck(
// through the app-limited period.
if (FLAGS_shift_quic_cubic_epoch_when_app_limited &&
app_limited_start_time_ != QuicTime::Zero()) {
- QuicTime::Delta shift = current_time.Subtract(app_limited_start_time_);
+ QuicTime::Delta shift = current_time - app_limited_start_time_;
DVLOG(1) << "Shifting epoch for quiescence by " << shift.ToMicroseconds();
- epoch_ = epoch_.Add(shift);
+ epoch_ = epoch_ + shift;
app_limited_start_time_ = QuicTime::Zero();
}
}
@@ -156,7 +156,7 @@ QuicPacketCount Cubic::CongestionWindowAfterAck(
// the round trip time in account. This is done to allow us to use shift as a
// divide operator.
int64_t elapsed_time =
- (current_time.Add(delay_min).Subtract(epoch_).ToMicroseconds() << 10) /
+ ((current_time + delay_min - epoch_).ToMicroseconds() << 10) /
kNumMicrosPerSecond;
int64_t offset = time_to_origin_point_ - elapsed_time;
« no previous file with comments | « no previous file | net/quic/congestion_control/cubic_bytes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698