Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |