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

Side by Side Diff: net/quic/congestion_control/leaky_bucket.h

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 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
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 // Helper class to track the rate data can leave the buffer for pacing. 5 // Helper class to track the rate data can leave the buffer for pacing.
6 // A leaky bucket drains the data at a constant rate regardless of fullness of 6 // A leaky bucket drains the data at a constant rate regardless of fullness of
7 // the buffer. 7 // the buffer.
8 // See http://en.wikipedia.org/wiki/Leaky_bucket for more details. 8 // See http://en.wikipedia.org/wiki/Leaky_bucket for more details.
9 9
10 #ifndef NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_ 10 #ifndef NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
11 #define NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_ 11 #define NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/quic/quic_bandwidth.h" 15 #include "net/quic/quic_bandwidth.h"
16 #include "net/quic/quic_clock.h" 16 #include "net/quic/quic_clock.h"
17 #include "net/quic/quic_protocol.h" 17 #include "net/quic/quic_protocol.h"
18 #include "net/quic/quic_time.h" 18 #include "net/quic/quic_time.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 class NET_EXPORT_PRIVATE LeakyBucket { 22 class NET_EXPORT_PRIVATE LeakyBucket {
23 public: 23 public:
24 // clock is not owned by this class. 24 explicit LeakyBucket(QuicBandwidth draining_rate);
25 LeakyBucket(const QuicClock* clock, QuicBandwidth draining_rate);
26 25
27 // Set the rate at which the bytes leave the buffer. 26 // Set the rate at which the bytes leave the buffer.
28 void SetDrainingRate(QuicBandwidth draining_rate); 27 void SetDrainingRate(QuicTime now, QuicBandwidth draining_rate);
29 28
30 // Add data to the buffer. 29 // Add data to the buffer.
31 void Add(QuicByteCount bytes); 30 void Add(QuicTime now, QuicByteCount bytes);
32 31
33 // Time until the buffer is empty in us. 32 // Time until the buffer is empty.
34 QuicTime::Delta TimeRemaining(); 33 QuicTime::Delta TimeRemaining(QuicTime now);
35 34
36 // Number of bytes in the buffer. 35 // Number of bytes in the buffer.
37 QuicByteCount BytesPending(); 36 QuicByteCount BytesPending(QuicTime now);
38 37
39 private: 38 private:
40 void Update(); 39 void Update(QuicTime now);
41 40
42 const QuicClock* clock_;
43 QuicByteCount bytes_; 41 QuicByteCount bytes_;
44 QuicTime time_last_updated_; 42 QuicTime time_last_updated_;
45 QuicBandwidth draining_rate_; 43 QuicBandwidth draining_rate_;
46 44
47 DISALLOW_COPY_AND_ASSIGN(LeakyBucket); 45 DISALLOW_COPY_AND_ASSIGN(LeakyBucket);
48 }; 46 };
49 47
50 } // namespace net 48 } // namespace net
51 49
52 #endif // NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_ 50 #endif // NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/hybrid_slow_start.cc ('k') | net/quic/congestion_control/leaky_bucket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698