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

Unified Diff: net/quic/congestion_control/windowed_filter.h

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
Index: net/quic/congestion_control/windowed_filter.h
diff --git a/net/quic/congestion_control/windowed_filter.h b/net/quic/congestion_control/windowed_filter.h
index 9c2ce1a894266b9396e0252b8418e0346f3924de..65dd866cb8ee27e8a99a859a4ccf7270239178f0 100644
--- a/net/quic/congestion_control/windowed_filter.h
+++ b/net/quic/congestion_control/windowed_filter.h
@@ -73,7 +73,7 @@ class WindowedFilter {
// is a new best, or if the newest recorded estimate is too old.
if (estimates_[0].sample == zero_value_ ||
Compare()(new_sample, estimates_[0].sample) ||
- new_time.Subtract(estimates_[2].time) > window_length_) {
+ new_time - estimates_[2].time > window_length_) {
Reset(new_sample, new_time);
return;
}
@@ -86,7 +86,7 @@ class WindowedFilter {
}
// Expire and update estimates as necessary.
- if (new_time.Subtract(estimates_[0].time) > window_length_) {
+ if (new_time - estimates_[0].time > window_length_) {
// The best estimate hasn't been updated for an entire window, so promote
// second and third best estimates.
estimates_[0] = estimates_[1];
@@ -96,14 +96,14 @@ class WindowedFilter {
// outside the window as well, since it may also have been recorded a
// long time ago. Don't need to iterate once more since we cover that
// case at the beginning of the method.
- if (new_time.Subtract(estimates_[0].time) > window_length_) {
+ if (new_time - estimates_[0].time > window_length_) {
estimates_[0] = estimates_[1];
estimates_[1] = estimates_[2];
}
return;
}
if (estimates_[1].sample == estimates_[0].sample &&
- new_time.Subtract(estimates_[1].time) > window_length_ >> 2) {
+ new_time - estimates_[1].time > window_length_ >> 2) {
// A quarter of the window has passed without a better sample, so the
// second-best estimate is taken from the second quarter of the window.
estimates_[2] = estimates_[1] = Sample(new_sample, new_time);
@@ -111,7 +111,7 @@ class WindowedFilter {
}
if (estimates_[2].sample == estimates_[1].sample &&
- new_time.Subtract(estimates_[2].time) > window_length_ >> 1) {
+ new_time - estimates_[2].time > window_length_ >> 1) {
// We've passed a half of the window without a better estimate, so take
// a third-best estimate from the second half of the window.
estimates_[2] = Sample(new_sample, new_time);
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_base.cc ('k') | net/quic/congestion_control/windowed_filter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698