summaryrefslogtreecommitdiffstats
path: root/net/base/bandwidth_metrics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/bandwidth_metrics.cc')
-rw-r--r--net/base/bandwidth_metrics.cc27
1 files changed, 3 insertions, 24 deletions
diff --git a/net/base/bandwidth_metrics.cc b/net/base/bandwidth_metrics.cc
index fa23a77..eaaa3c0 100644
--- a/net/base/bandwidth_metrics.cc
+++ b/net/base/bandwidth_metrics.cc
@@ -2,35 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/lazy_instance.h"
+#include "base/singleton.h"
#include "net/base/bandwidth_metrics.h"
-static base::LazyInstance<net::BandwidthMetrics> g_bandwidth_metrics(
- base::LINKER_INITIALIZED);
-
namespace net {
ScopedBandwidthMetrics::ScopedBandwidthMetrics()
- : started_(false) {
-}
-
-ScopedBandwidthMetrics::~ScopedBandwidthMetrics() {
- if (started_)
- g_bandwidth_metrics.Get().StopStream();
-}
-
-void ScopedBandwidthMetrics::StartStream() {
- started_ = true;
- g_bandwidth_metrics.Get().StartStream();
-}
-
-void ScopedBandwidthMetrics::StopStream() {
- started_ = false;
- g_bandwidth_metrics.Get().StopStream();
-}
-
-void ScopedBandwidthMetrics::RecordBytes(int bytes) {
- g_bandwidth_metrics.Get().RecordBytes(bytes);
+ : metrics_(Singleton<BandwidthMetrics>::get()),
+ started_(false) {
}
} // namespace net