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

Side by Side Diff: remoting/base/rate_counter.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 4 years, 12 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
« no previous file with comments | « remoting/base/rate_counter.h ('k') | remoting/base/rate_counter_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "remoting/base/rate_counter.h" 5 #include "remoting/base/rate_counter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace remoting { 9 namespace remoting {
10 10
11 RateCounter::RateCounter(base::TimeDelta time_window) 11 RateCounter::RateCounter(base::TimeDelta time_window)
12 : time_window_(time_window), 12 : time_window_(time_window),
13 sum_(0) { 13 sum_(0) {
14 DCHECK_GT(time_window.InMilliseconds(), 0); 14 DCHECK_GT(time_window.InMilliseconds(), 0);
15 } 15 }
16 16
17 RateCounter::~RateCounter() { 17 RateCounter::~RateCounter() {
18 } 18 }
19 19
20 void RateCounter::Record(int64 value) { 20 void RateCounter::Record(int64_t value) {
21 DCHECK(CalledOnValidThread()); 21 DCHECK(CalledOnValidThread());
22 22
23 base::Time current_time = CurrentTime(); 23 base::Time current_time = CurrentTime();
24 EvictOldDataPoints(current_time); 24 EvictOldDataPoints(current_time);
25 sum_ += value; 25 sum_ += value;
26 data_points_.push(std::make_pair(current_time, value)); 26 data_points_.push(std::make_pair(current_time, value));
27 } 27 }
28 28
29 double RateCounter::Rate() { 29 double RateCounter::Rate() {
30 DCHECK(CalledOnValidThread()); 30 DCHECK(CalledOnValidThread());
(...skipping 22 matching lines...) Expand all
53 } 53 }
54 } 54 }
55 55
56 base::Time RateCounter::CurrentTime() const { 56 base::Time RateCounter::CurrentTime() const {
57 if (current_time_for_test_ == base::Time()) 57 if (current_time_for_test_ == base::Time())
58 return base::Time::Now(); 58 return base::Time::Now();
59 return current_time_for_test_; 59 return current_time_for_test_;
60 } 60 }
61 61
62 } // namespace remoting 62 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/rate_counter.h ('k') | remoting/base/rate_counter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698