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
3 // found in the LICENSE file.
5 #include "base/lazy_instance.h"
6 #include "net/base/bandwidth_metrics.h"
8 static base::LazyInstance
<net::BandwidthMetrics
> g_bandwidth_metrics
=
9 LAZY_INSTANCE_INITIALIZER
;
13 ScopedBandwidthMetrics::ScopedBandwidthMetrics()
17 ScopedBandwidthMetrics::~ScopedBandwidthMetrics() {
19 g_bandwidth_metrics
.Get().StopStream();
22 void ScopedBandwidthMetrics::StartStream() {
24 g_bandwidth_metrics
.Get().StartStream();
27 void ScopedBandwidthMetrics::StopStream() {
29 g_bandwidth_metrics
.Get().StopStream();
32 void ScopedBandwidthMetrics::RecordBytes(int bytes
) {
33 g_bandwidth_metrics
.Get().RecordBytes(bytes
);