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

Side by Side Diff: net/quic/congestion_control/hybrid_slow_start.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/congestion_control/hybrid_slow_start.h" 5 #include "net/quic/congestion_control/hybrid_slow_start.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 using std::max; 9 using std::max;
10 using std::min; 10 using std::min;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Divide min_rtt by 8 to get a rtt increase threshold for exiting. 87 // Divide min_rtt by 8 to get a rtt increase threshold for exiting.
88 int64_t min_rtt_increase_threshold_us = 88 int64_t min_rtt_increase_threshold_us =
89 min_rtt.ToMicroseconds() >> kHybridStartDelayFactorExp; 89 min_rtt.ToMicroseconds() >> kHybridStartDelayFactorExp;
90 // Ensure the rtt threshold is never less than 2ms or more than 16ms. 90 // Ensure the rtt threshold is never less than 2ms or more than 16ms.
91 min_rtt_increase_threshold_us = 91 min_rtt_increase_threshold_us =
92 min(min_rtt_increase_threshold_us, kHybridStartDelayMaxThresholdUs); 92 min(min_rtt_increase_threshold_us, kHybridStartDelayMaxThresholdUs);
93 QuicTime::Delta min_rtt_increase_threshold = 93 QuicTime::Delta min_rtt_increase_threshold =
94 QuicTime::Delta::FromMicroseconds(max(min_rtt_increase_threshold_us, 94 QuicTime::Delta::FromMicroseconds(max(min_rtt_increase_threshold_us,
95 kHybridStartDelayMinThresholdUs)); 95 kHybridStartDelayMinThresholdUs));
96 96
97 if (current_min_rtt_ > min_rtt.Add(min_rtt_increase_threshold)) { 97 if (current_min_rtt_ > min_rtt + min_rtt_increase_threshold) {
98 hystart_found_ = DELAY; 98 hystart_found_ = DELAY;
99 } 99 }
100 } 100 }
101 // Exit from slow start if the cwnd is greater than 16 and 101 // Exit from slow start if the cwnd is greater than 16 and
102 // increasing delay is found. 102 // increasing delay is found.
103 return congestion_window >= kHybridStartLowWindow && 103 return congestion_window >= kHybridStartLowWindow &&
104 hystart_found_ != NOT_FOUND; 104 hystart_found_ != NOT_FOUND;
105 } 105 }
106 106
107 } // namespace net 107 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/general_loss_algorithm_test.cc ('k') | net/quic/congestion_control/hybrid_slow_start_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698