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

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

Issue 189403002: QUIC - Minor cleanup changes to match the internal source code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use public ::testing:: Created 6 years, 9 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
« no previous file with comments | « no previous file | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/paced_sender.h" 5 #include "net/quic/congestion_control/paced_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "net/quic/quic_protocol.h" 9 #include "net/quic/quic_protocol.h"
10 10
11 using std::max;
12
11 namespace net { 13 namespace net {
12 14
13 // To prevent too aggressive pacing we allow the following packet burst size. 15 // To prevent too aggressive pacing we allow the following packet burst size.
14 const int64 kMinPacketBurstSize = 2; 16 const int64 kMinPacketBurstSize = 2;
15 // Max estimated time between calls to TimeUntilSend and 17 // Max estimated time between calls to TimeUntilSend and
16 // AvailableCongestionWindow. 18 // AvailableCongestionWindow.
17 const int64 kMaxSchedulingDelayUs = 2000; 19 const int64 kMaxSchedulingDelayUs = 2000;
18 20
19 PacedSender::PacedSender(QuicBandwidth estimate, QuicByteCount max_segment_size) 21 PacedSender::PacedSender(QuicBandwidth estimate, QuicByteCount max_segment_size)
20 : leaky_bucket_(estimate), 22 : leaky_bucket_(estimate),
(...skipping 13 matching lines...) Expand all
34 36
35 QuicTime::Delta PacedSender::TimeUntilSend(QuicTime now, 37 QuicTime::Delta PacedSender::TimeUntilSend(QuicTime now,
36 QuicTime::Delta time_until_send) { 38 QuicTime::Delta time_until_send) {
37 if (time_until_send.ToMicroseconds() >= kMaxSchedulingDelayUs) { 39 if (time_until_send.ToMicroseconds() >= kMaxSchedulingDelayUs) {
38 return time_until_send; 40 return time_until_send;
39 } 41 }
40 // Pace the data. 42 // Pace the data.
41 QuicByteCount pacing_window = pace_.ToBytesPerPeriod( 43 QuicByteCount pacing_window = pace_.ToBytesPerPeriod(
42 QuicTime::Delta::FromMicroseconds(kMaxSchedulingDelayUs)); 44 QuicTime::Delta::FromMicroseconds(kMaxSchedulingDelayUs));
43 QuicByteCount min_window_size = kMinPacketBurstSize * max_segment_size_; 45 QuicByteCount min_window_size = kMinPacketBurstSize * max_segment_size_;
44 pacing_window = std::max(pacing_window, min_window_size); 46 pacing_window = max(pacing_window, min_window_size);
45 47
46 if (pacing_window > leaky_bucket_.BytesPending(now)) { 48 if (pacing_window > leaky_bucket_.BytesPending(now)) {
47 // We have not filled our pacing window yet. 49 // We have not filled our pacing window yet.
48 return time_until_send; 50 return time_until_send;
49 } 51 }
50 return leaky_bucket_.TimeRemaining(now); 52 return leaky_bucket_.TimeRemaining(now);
51 } 53 }
52 54
53 } // namespace net 55 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698