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 <jni.h> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/macros.h" | |
14 #include "base/memory/scoped_ptr.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 cronet { | |
20 | |
21 bool HistogramManagerRegisterJni(JNIEnv* env); | |
22 | |
23 // A HistogramManager instance is created by Android. It is the central | |
24 // controller for the acquisition of log data, and the automatic transmission of | |
25 // that log data to an external server. | |
26 class HistogramManager : public base::HistogramFlattener { | |
27 public: | |
28 HistogramManager(); | |
29 ~HistogramManager(); | |
30 | |
31 // --------------------------- | |
32 // HistogramFlattener methods: | |
Alexei Svitkine (slow)
2014/12/10 21:50:17
Nit: I think convention for new code is to have th
ramant (doing other things)
2014/12/10 22:27:51
Done.
| |
33 // --------------------------- | |
34 void RecordDelta(const base::HistogramBase& histogram, | |
35 const base::HistogramSamples& snapshot) override; | |
36 void InconsistencyDetected( | |
37 base::HistogramBase::Inconsistency problem) override; | |
38 void UniqueInconsistencyDetected( | |
39 base::HistogramBase::Inconsistency problem) override; | |
40 void InconsistencyDetectedInLoggedCount(int amount) override; | |
41 | |
42 // Snapshot all histograms to record the delta by calling | |
43 // |histogram_snapshot_manager_|'s PrepareDeltas() method. | |
44 void PrepareDeltas(); | |
45 | |
46 const metrics::ChromeUserMetricsExtension& uma_proto() const { | |
47 return uma_proto_; | |
48 } | |
49 | |
50 private: | |
51 void RecordHistogramDelta(const std::string& histogram_name, | |
52 const base::HistogramSamples& snapshot); | |
53 | |
54 base::HistogramSnapshotManager histogram_snapshot_manager_; | |
55 | |
56 // Stores the protocol buffer representation for this log. | |
57 metrics::ChromeUserMetricsExtension uma_proto_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(HistogramManager); | |
60 }; | |
61 | |
62 } // namespace cronet | |
63 | |
64 #endif // COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_ | |
OLD | NEW |