| 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 #ifndef COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ | 5 #ifndef COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ |
| 6 #define COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ | 6 #define COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Snapshot all histograms to record the delta into |uma_proto_| and then | 31 // Snapshot all histograms to record the delta into |uma_proto_| and then |
| 32 // returns the serialized protobuf representation of the record in |data|. | 32 // returns the serialized protobuf representation of the record in |data|. |
| 33 // Returns true if it was successfully serialized. | 33 // Returns true if it was successfully serialized. |
| 34 bool GetDeltas(std::vector<uint8_t>* data); | 34 bool GetDeltas(std::vector<uint8_t>* data); |
| 35 | 35 |
| 36 // TODO(mef): Hang Histogram Manager off java object instead of singleton. | 36 // TODO(mef): Hang Histogram Manager off java object instead of singleton. |
| 37 static HistogramManager* GetInstance(); | 37 static HistogramManager* GetInstance(); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 friend struct base::DefaultLazyInstanceTraits<HistogramManager>; | 40 friend struct base::LazyInstanceTraitsBase<HistogramManager>; |
| 41 | 41 |
| 42 // base::HistogramFlattener: | 42 // base::HistogramFlattener: |
| 43 void RecordDelta(const base::HistogramBase& histogram, | 43 void RecordDelta(const base::HistogramBase& histogram, |
| 44 const base::HistogramSamples& snapshot) override; | 44 const base::HistogramSamples& snapshot) override; |
| 45 void InconsistencyDetected( | 45 void InconsistencyDetected( |
| 46 base::HistogramBase::Inconsistency problem) override; | 46 base::HistogramBase::Inconsistency problem) override; |
| 47 void UniqueInconsistencyDetected( | 47 void UniqueInconsistencyDetected( |
| 48 base::HistogramBase::Inconsistency problem) override; | 48 base::HistogramBase::Inconsistency problem) override; |
| 49 void InconsistencyDetectedInLoggedCount(int amount) override; | 49 void InconsistencyDetectedInLoggedCount(int amount) override; |
| 50 | 50 |
| 51 base::HistogramSnapshotManager histogram_snapshot_manager_; | 51 base::HistogramSnapshotManager histogram_snapshot_manager_; |
| 52 | 52 |
| 53 // Stores the protocol buffer representation for this log. | 53 // Stores the protocol buffer representation for this log. |
| 54 metrics::ChromeUserMetricsExtension uma_proto_; | 54 metrics::ChromeUserMetricsExtension uma_proto_; |
| 55 | 55 |
| 56 // Should be acquired whenever GetDeltas() is executing to maintain | 56 // Should be acquired whenever GetDeltas() is executing to maintain |
| 57 // thread-safety. | 57 // thread-safety. |
| 58 base::Lock get_deltas_lock_; | 58 base::Lock get_deltas_lock_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(HistogramManager); | 60 DISALLOW_COPY_AND_ASSIGN(HistogramManager); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace cronet | 63 } // namespace cronet |
| 64 | 64 |
| 65 #endif // COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ | 65 #endif // COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ |
| OLD | NEW |