isolate_driver: Enable ninja parsing code all the time.
[chromium-blink-merge.git] / net / base / bandwidth_metrics.cc
blob0644122d7ddc7dd7e7c0c7049bc3d2db5a0d5f0c
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;
11 namespace net {
13 ScopedBandwidthMetrics::ScopedBandwidthMetrics()
14 : started_(false) {
17 ScopedBandwidthMetrics::~ScopedBandwidthMetrics() {
18 if (started_)
19 g_bandwidth_metrics.Get().StopStream();
22 void ScopedBandwidthMetrics::StartStream() {
23 started_ = true;
24 g_bandwidth_metrics.Get().StartStream();
27 void ScopedBandwidthMetrics::StopStream() {
28 started_ = false;
29 g_bandwidth_metrics.Get().StopStream();
32 void ScopedBandwidthMetrics::RecordBytes(int bytes) {
33 g_bandwidth_metrics.Get().RecordBytes(bytes);
36 } // namespace net