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

Side by Side Diff: net/quic/congestion_control/hybrid_slow_start.cc

Issue 11961022: Remove default constructors for QuicTime and QuicTime::Delta and used static Zero() methods instead… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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 namespace net { 7 namespace net {
8 8
9 // Note(pwestin): the magic clamping numbers come from the original code in 9 // Note(pwestin): the magic clamping numbers come from the original code in
10 // tcp_cubic.c. 10 // tcp_cubic.c.
11 // Number of delay samples for detecting the increase of delay. 11 // Number of delay samples for detecting the increase of delay.
12 const int kHybridStartMinSamples = 8; 12 const int kHybridStartMinSamples = 8;
13 const int kHybridStartDelayFactorExp = 4; // 2^4 = 16 13 const int kHybridStartDelayFactorExp = 4; // 2^4 = 16
14 const int kHybridStartDelayMinThresholdUs = 2000; 14 const int kHybridStartDelayMinThresholdUs = 2000;
15 const int kHybridStartDelayMaxThresholdUs = 16000; 15 const int kHybridStartDelayMaxThresholdUs = 16000;
16 16
17 HybridSlowStart::HybridSlowStart(const QuicClock* clock) 17 HybridSlowStart::HybridSlowStart(const QuicClock* clock)
18 : clock_(clock), 18 : clock_(clock),
19 started_(false), 19 started_(false),
20 found_ack_train_(false), 20 found_ack_train_(false),
21 found_delay_(false), 21 found_delay_(false),
22 round_start_(QuicTime::Zero()),
22 end_sequence_number_(0), 23 end_sequence_number_(0),
23 sample_count_(0) { 24 last_time_(QuicTime::Zero()),
25 sample_count_(0),
26 current_rtt_(QuicTime::Delta::Zero()) {
24 } 27 }
25 28
26 void HybridSlowStart::Restart() { 29 void HybridSlowStart::Restart() {
27 found_ack_train_ = false; 30 found_ack_train_ = false;
28 found_delay_ = false; 31 found_delay_ = false;
29 } 32 }
30 33
31 void HybridSlowStart::Reset(QuicPacketSequenceNumber end_sequence_number) { 34 void HybridSlowStart::Reset(QuicPacketSequenceNumber end_sequence_number) {
32 DLOG(INFO) << "Reset hybrid slow start @" << end_sequence_number; 35 DLOG(INFO) << "Reset hybrid slow start @" << end_sequence_number;
33 round_start_ = last_time_ = clock_->Now(); 36 round_start_ = last_time_ = clock_->Now();
34 end_sequence_number_ = end_sequence_number; 37 end_sequence_number_ = end_sequence_number;
35 current_rtt_ = QuicTime::Delta(); // Reset to 0. 38 current_rtt_ = QuicTime::Delta::Zero();
36 sample_count_ = 0; 39 sample_count_ = 0;
37 started_ = true; 40 started_ = true;
38 } 41 }
39 42
40 bool HybridSlowStart::EndOfRound(QuicPacketSequenceNumber ack) { 43 bool HybridSlowStart::EndOfRound(QuicPacketSequenceNumber ack) {
41 // TODO(pwestin): do we need to handle wraparound? 44 // TODO(pwestin): do we need to handle wraparound?
42 return end_sequence_number_ <= ack; 45 return end_sequence_number_ <= ack;
43 } 46 }
44 47
45 void HybridSlowStart::Update(QuicTime::Delta rtt, QuicTime::Delta delay_min) { 48 void HybridSlowStart::Update(QuicTime::Delta rtt, QuicTime::Delta delay_min) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool HybridSlowStart::Exit() { 99 bool HybridSlowStart::Exit() {
97 // If either one of the two conditions are met we exit from slow start 100 // If either one of the two conditions are met we exit from slow start
98 // immediately. 101 // immediately.
99 if (found_ack_train_ || found_delay_) { 102 if (found_ack_train_ || found_delay_) {
100 return true; 103 return true;
101 } 104 }
102 return false; 105 return false;
103 } 106 }
104 107
105 } // namespace net 108 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698