OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_ | |
6 #define COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/singleton.h" | |
15 #include "base/metrics/histogram_flattener.h" | |
16 #include "base/metrics/histogram_snapshot_manager.h" | |
17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | |
18 | |
19 namespace metrics { | |
20 | |
21 // A HistogramManager instance is created by Android. It is the central | |
22 // controller for the acquisition of log data, and the automatic transmission of | |
23 // that log data to an external server. | |
24 class HistogramManager : public base::HistogramFlattener { | |
Alexei Svitkine (slow)
2014/12/11 20:29:28
Please add a TODO() here to move it to components/
ramant (doing other things)
2014/12/11 23:10:42
Done.
| |
25 public: | |
26 HistogramManager(); | |
27 ~HistogramManager(); | |
28 | |
29 // Snapshot all histograms to record the delta into |uma_proto_| and then | |
30 // returns the serialized protobuf representation of the record. | |
31 std::vector<uint8> GetDeltas(); | |
32 | |
33 // TODO(mef): Hang Histogram Manager off java object instead of singleton. | |
34 static HistogramManager* GetInstance(); | |
35 | |
36 private: | |
37 friend struct DefaultSingletonTraits<HistogramManager>; | |
38 | |
39 // base::HistogramFlattener: | |
40 void RecordDelta(const base::HistogramBase& histogram, | |
41 const base::HistogramSamples& snapshot) override; | |
42 void InconsistencyDetected( | |
43 base::HistogramBase::Inconsistency problem) override; | |
44 void UniqueInconsistencyDetected( | |
45 base::HistogramBase::Inconsistency problem) override; | |
46 void InconsistencyDetectedInLoggedCount(int amount) override; | |
47 | |
48 base::HistogramSnapshotManager histogram_snapshot_manager_; | |
49 | |
50 // Stores the protocol buffer representation for this log. | |
51 metrics::ChromeUserMetricsExtension uma_proto_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(HistogramManager); | |
54 }; | |
55 | |
56 } // namespace metrics | |
57 | |
58 #endif // COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_ | |
OLD | NEW |