Index: net/quic/congestion_control/leaky_bucket.cc |
diff --git a/net/quic/congestion_control/leaky_bucket.cc b/net/quic/congestion_control/leaky_bucket.cc |
deleted file mode 100644 |
index f3972f62eaca0b32b0076d07dc4e661587be80a5..0000000000000000000000000000000000000000 |
--- a/net/quic/congestion_control/leaky_bucket.cc |
+++ /dev/null |
@@ -1,54 +0,0 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include "net/quic/congestion_control/leaky_bucket.h" |
- |
-#include "base/time/time.h" |
- |
-namespace net { |
- |
-LeakyBucket::LeakyBucket(QuicBandwidth draining_rate) |
- : bytes_(0), |
- time_last_updated_(QuicTime::Zero()), |
- draining_rate_(draining_rate) { |
-} |
- |
-void LeakyBucket::SetDrainingRate(QuicTime now, QuicBandwidth draining_rate) { |
- Update(now); |
- draining_rate_ = draining_rate; |
-} |
- |
-void LeakyBucket::Add(QuicTime now, QuicByteCount bytes) { |
- Update(now); |
- bytes_ += bytes; |
-} |
- |
-QuicTime::Delta LeakyBucket::TimeRemaining(QuicTime now) const { |
- QuicTime::Delta time_since_last_update = now.Subtract(time_last_updated_); |
- QuicTime::Delta send_delay = QuicTime::Delta::FromMicroseconds( |
- (bytes_ * base::Time::kMicrosecondsPerSecond) / |
- draining_rate_.ToBytesPerSecond()); |
- if (send_delay < time_since_last_update) { |
- return QuicTime::Delta::Zero(); |
- } |
- return send_delay.Subtract(time_since_last_update); |
-} |
- |
-QuicByteCount LeakyBucket::BytesPending(QuicTime now) { |
- Update(now); |
- return bytes_; |
-} |
- |
-void LeakyBucket::Update(QuicTime now) { |
- QuicTime::Delta elapsed_time = now.Subtract(time_last_updated_); |
- QuicByteCount bytes_cleared = draining_rate_.ToBytesPerPeriod(elapsed_time); |
- if (bytes_cleared >= bytes_) { |
- bytes_ = 0; |
- } else { |
- bytes_ -= bytes_cleared; |
- } |
- time_last_updated_ = now; |
-} |
- |
-} // namespace net |