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

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

Issue 125403006: Various QUIC cleanups to sync with internal code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 6 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/fix_rate_sender.h" 5 #include "net/quic/congestion_control/fix_rate_sender.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/quic/quic_protocol.h" 12 #include "net/quic/quic_protocol.h"
13 13
14 using std::max;
15
14 namespace { 16 namespace {
15 const int kInitialBitrate = 100000; // In bytes per second. 17 const int kInitialBitrate = 100000; // In bytes per second.
16 const uint64 kWindowSizeUs = 10000; // 10 ms. 18 const uint64 kWindowSizeUs = 10000; // 10 ms.
17 } 19 }
18 20
19 namespace net { 21 namespace net {
20 22
21 FixRateSender::FixRateSender(const QuicClock* clock) 23 FixRateSender::FixRateSender(const QuicClock* clock)
22 : bitrate_(QuicBandwidth::FromBytesPerSecond(kInitialBitrate)), 24 : bitrate_(QuicBandwidth::FromBytesPerSecond(kInitialBitrate)),
23 max_segment_size_(kDefaultMaxPacketSize), 25 max_segment_size_(kDefaultMaxPacketSize),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // We need an ack before we send more. 113 // We need an ack before we send more.
112 return QuicTime::Delta::Infinite(); 114 return QuicTime::Delta::Infinite();
113 } 115 }
114 return paced_sender_.TimeUntilSend(now, time_remaining); 116 return paced_sender_.TimeUntilSend(now, time_remaining);
115 } 117 }
116 118
117 QuicByteCount FixRateSender::CongestionWindow() { 119 QuicByteCount FixRateSender::CongestionWindow() {
118 QuicByteCount window_size_bytes = bitrate_.ToBytesPerPeriod( 120 QuicByteCount window_size_bytes = bitrate_.ToBytesPerPeriod(
119 QuicTime::Delta::FromMicroseconds(kWindowSizeUs)); 121 QuicTime::Delta::FromMicroseconds(kWindowSizeUs));
120 // Make sure window size is not less than a packet. 122 // Make sure window size is not less than a packet.
121 return std::max(kDefaultMaxPacketSize, window_size_bytes); 123 return max(kDefaultMaxPacketSize, window_size_bytes);
122 } 124 }
123 125
124 QuicBandwidth FixRateSender::BandwidthEstimate() const { 126 QuicBandwidth FixRateSender::BandwidthEstimate() const {
125 return bitrate_; 127 return bitrate_;
126 } 128 }
127 129
128 QuicTime::Delta FixRateSender::SmoothedRtt() const { 130 QuicTime::Delta FixRateSender::SmoothedRtt() const {
129 // TODO(satyamshekhar): Calculate and return smoothed rtt. 131 // TODO(satyamshekhar): Calculate and return smoothed rtt.
130 return latest_rtt_; 132 return latest_rtt_;
131 } 133 }
132 134
133 QuicTime::Delta FixRateSender::RetransmissionDelay() const { 135 QuicTime::Delta FixRateSender::RetransmissionDelay() const {
134 // TODO(pwestin): Calculate and return retransmission delay. 136 // TODO(pwestin): Calculate and return retransmission delay.
135 // Use 2 * the latest RTT for now. 137 // Use 2 * the latest RTT for now.
136 return latest_rtt_.Add(latest_rtt_); 138 return latest_rtt_.Add(latest_rtt_);
137 } 139 }
138 140
139 QuicByteCount FixRateSender::GetCongestionWindow() const { 141 QuicByteCount FixRateSender::GetCongestionWindow() const {
140 return 0; 142 return 0;
141 } 143 }
142 144
143 } // namespace net 145 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/cubic_test.cc ('k') | net/quic/congestion_control/hybrid_slow_start.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698