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

Side by Side Diff: components/cronet/histogram_manager.cc

Issue 1882563004: [Cronet] Make HistogramManager public APIs thread-safe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « components/cronet/histogram_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/histogram_manager.h" 5 #include "components/cronet/histogram_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowserUnique.Cronet", 46 UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesBrowserUnique.Cronet",
47 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE); 47 problem, base::HistogramBase::NEVER_EXCEEDED_VALUE);
48 } 48 }
49 49
50 void HistogramManager::InconsistencyDetectedInLoggedCount(int amount) { 50 void HistogramManager::InconsistencyDetectedInLoggedCount(int amount) {
51 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotBrowser.Cronet", 51 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentSnapshotBrowser.Cronet",
52 std::abs(amount)); 52 std::abs(amount));
53 } 53 }
54 54
55 bool HistogramManager::GetDeltas(std::vector<uint8_t>* data) { 55 bool HistogramManager::GetDeltas(std::vector<uint8_t>* data) {
56 base::AutoLock lock(lock_);
bcwhite 2016/04/13 14:12:52 It doesn't make sense to make multiple, parallel c
pauljensen 2016/04/13 14:29:45 It may not make sense to do this, but we shouldn't
bcwhite 2016/04/13 14:42:18 If this method were to be called while some "futur
56 // Clear the protobuf between calls. 57 // Clear the protobuf between calls.
57 uma_proto_.Clear(); 58 uma_proto_.Clear();
58 // "false" to StatisticsRecorder::begin() indicates to *not* include 59 // "false" to StatisticsRecorder::begin() indicates to *not* include
59 // histograms held in persistent storage on the assumption that they will be 60 // histograms held in persistent storage on the assumption that they will be
60 // visible to the recipient through other means. 61 // visible to the recipient through other means.
61 histogram_snapshot_manager_.PrepareDeltas( 62 histogram_snapshot_manager_.PrepareDeltas(
62 base::StatisticsRecorder::begin(false), base::StatisticsRecorder::end(), 63 base::StatisticsRecorder::begin(false), base::StatisticsRecorder::end(),
63 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag); 64 base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag);
64 int32_t data_size = uma_proto_.ByteSize(); 65 int32_t data_size = uma_proto_.ByteSize();
65 data->resize(data_size); 66 data->resize(data_size);
66 if (uma_proto_.SerializeToArray(&(*data)[0], data_size)) 67 if (uma_proto_.SerializeToArray(&(*data)[0], data_size))
67 return true; 68 return true;
68 data->clear(); 69 data->clear();
69 return false; 70 return false;
70 } 71 }
71 72
72 } // namespace cronet 73 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/histogram_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698