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

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

Issue 11961022: Remove default constructors for QuicTime and QuicTime::Delta and used static Zero() methods instead… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/leaky_bucket.h" 5 #include "net/quic/congestion_control/leaky_bucket.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 LeakyBucket::LeakyBucket(const QuicClock* clock, int bytes_per_second) 11 LeakyBucket::LeakyBucket(const QuicClock* clock, int bytes_per_second)
12 : clock_(clock), 12 : clock_(clock),
13 bytes_(0), 13 bytes_(0),
14 time_last_updated_(QuicTime::Zero()),
14 draining_rate_bytes_per_s_(bytes_per_second) { 15 draining_rate_bytes_per_s_(bytes_per_second) {
15 } 16 }
16 17
17 void LeakyBucket::SetDrainingRate(int bytes_per_second) { 18 void LeakyBucket::SetDrainingRate(int bytes_per_second) {
18 Update(); 19 Update();
19 draining_rate_bytes_per_s_ = bytes_per_second; 20 draining_rate_bytes_per_s_ = bytes_per_second;
20 } 21 }
21 22
22 void LeakyBucket::Add(size_t bytes) { 23 void LeakyBucket::Add(size_t bytes) {
23 Update(); 24 Update();
(...skipping 19 matching lines...) Expand all
43 base::Time::kMicrosecondsPerSecond; 44 base::Time::kMicrosecondsPerSecond;
44 if (bytes_cleared >= bytes_) { 45 if (bytes_cleared >= bytes_) {
45 bytes_ = 0; 46 bytes_ = 0;
46 } else { 47 } else {
47 bytes_ -= bytes_cleared; 48 bytes_ -= bytes_cleared;
48 } 49 }
49 time_last_updated_ = clock_->Now(); 50 time_last_updated_ = clock_->Now();
50 } 51 }
51 52
52 } // namespace net 53 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698