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

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

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4 //
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
7 // the buffer.
8 // See http://en.wikipedia.org/wiki/Leaky_bucket for more details.
9
10 #ifndef NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
11 #define NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
12
13 #include "base/basictypes.h"
14 #include "net/base/net_export.h"
15 #include "net/quic/quic_bandwidth.h"
16 #include "net/quic/quic_protocol.h"
17 #include "net/quic/quic_time.h"
18
19 namespace net {
20
21 class NET_EXPORT_PRIVATE LeakyBucket {
22 public:
23 explicit LeakyBucket(QuicBandwidth draining_rate);
24
25 // Set the rate at which the bytes leave the buffer.
26 void SetDrainingRate(QuicTime now, QuicBandwidth draining_rate);
27
28 // Add data to the buffer.
29 void Add(QuicTime now, QuicByteCount bytes);
30
31 // Time until the buffer is empty.
32 QuicTime::Delta TimeRemaining(QuicTime now) const;
33
34 // Number of bytes in the buffer.
35 QuicByteCount BytesPending(QuicTime now);
36
37 private:
38 void Update(QuicTime now);
39
40 QuicByteCount bytes_;
41 QuicTime time_last_updated_;
42 QuicBandwidth draining_rate_;
43
44 DISALLOW_COPY_AND_ASSIGN(LeakyBucket);
45 };
46
47 } // namespace net
48
49 #endif // NET_QUIC_CONGESTION_CONTROL_LEAKY_BUCKET_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/hybrid_slow_start_test.cc ('k') | net/quic/congestion_control/leaky_bucket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698