Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 #ifndef BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_ | |
| 6 #define BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/base_export.h" | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/metrics/histogram_flattener.h" | |
| 15 | |
| 16 namespace base { | |
| 17 | |
| 18 class HistogramSnapshotManager; | |
| 19 | |
| 20 // Serializes and restores histograms deltas. | |
| 21 class BASE_EXPORT HistogramDeltasSerializer : private HistogramFlattener { | |
|
Ilya Sherman
2013/10/17 04:37:42
Why does this class use private inheritance? That
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
There is nothing wrong with private inheritance. B
Ilya Sherman
2013/10/17 22:41:46
FYI, from the style guide: "Composition is often m
Vitaly Buka (NO REVIEWS)
2013/10/18 05:33:34
Thanks.
On 2013/10/17 22:41:46, Ilya Sherman wrot
| |
| 22 public: | |
| 23 typedef std::vector<std::string> SerializedDeltas; | |
|
Ilya Sherman
2013/10/17 04:37:42
nit: I'd prefer that you spell out the full typena
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
| |
| 24 | |
| 25 // |caller_name| is string used in histograms for counting inconsistencies. | |
| 26 explicit HistogramDeltasSerializer(const std::string& caller_name); | |
| 27 | |
|
Ilya Sherman
2013/10/17 04:37:42
nit: It's typical to omit this blank line between
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
| |
| 28 virtual ~HistogramDeltasSerializer(); | |
| 29 | |
| 30 // Returns vector of strings with serialized histograms deltas changed a | |
| 31 // previous call. | |
|
Ilya Sherman
2013/10/17 04:37:42
nit: Missing word from this comment?
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
| |
| 32 const SerializedDeltas& GetNewDeltas(); | |
| 33 | |
| 34 // Deserialize deltas and add samples to corresponding histograms. | |
|
Ilya Sherman
2013/10/17 04:37:42
nit: "to corresponding histograms" -> "to correspo
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
| |
| 35 // Silently ignores errors in |deltas|. | |
| 36 static void DeserializeAndAddSamples(const SerializedDeltas& deltas); | |
| 37 | |
| 38 private: | |
| 39 // HistogramFlattener implementation. | |
| 40 virtual void RecordDelta(const HistogramBase& histogram, | |
| 41 const HistogramSamples& snapshot) OVERRIDE; | |
| 42 virtual void InconsistencyDetected( | |
| 43 HistogramBase::Inconsistency problem) OVERRIDE; | |
| 44 virtual void UniqueInconsistencyDetected( | |
| 45 HistogramBase::Inconsistency problem) OVERRIDE; | |
| 46 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; | |
| 47 | |
| 48 std::string caller_name_; | |
| 49 scoped_ptr<HistogramSnapshotManager> histogram_snapshot_manager_; | |
| 50 SerializedDeltas histograms_; | |
|
Ilya Sherman
2013/10/17 04:37:42
nit: serialized_deltas_ would probably be a cleare
Ilya Sherman
2013/10/17 04:37:42
nit: Please document all of these variables.
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
Vitaly Buka (NO REVIEWS)
2013/10/17 10:15:47
Done.
| |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(HistogramDeltasSerializer); | |
| 53 }; | |
| 54 | |
| 55 } // namespace base | |
| 56 | |
| 57 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_ | |
| OLD | NEW |