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

Unified Diff: remoting/base/running_average.cc

Issue 12803008: Add unit tests for sub-components of CaptureScheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pick nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/base/running_average.h ('k') | remoting/base/running_average_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/running_average.cc
diff --git a/remoting/base/running_average.cc b/remoting/base/running_average.cc
index 4daa650ac9d0b5604af784a89ec7ea36da001777..dd7c7bedb7d755abfc2ab770fa2a25ff898f64b6 100644
--- a/remoting/base/running_average.cc
+++ b/remoting/base/running_average.cc
@@ -2,22 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/logging.h"
#include "remoting/base/running_average.h"
+#include "base/logging.h"
+
namespace remoting {
RunningAverage::RunningAverage(int window_size)
: window_size_(window_size),
sum_(0) {
- CHECK(window_size_);
+ DCHECK_GT(window_size, 0);
}
RunningAverage::~RunningAverage() {
}
void RunningAverage::Record(int64 value) {
- base::AutoLock auto_lock(lock_);
+ DCHECK(CalledOnValidThread());
data_points_.push_back(value);
sum_ += value;
@@ -28,8 +29,8 @@ void RunningAverage::Record(int64 value) {
}
}
-double RunningAverage::Average() {
- base::AutoLock auto_lock(lock_);
+double RunningAverage::Average() const {
+ DCHECK(CalledOnValidThread());
if (data_points_.empty())
return 0;
« no previous file with comments | « remoting/base/running_average.h ('k') | remoting/base/running_average_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698