Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: components/metrics/histogram_manager.h

Issue 1075503002: Move histogram_manager from components/metrics to components/cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Raman's comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/histogram_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_METRICS_HISTOGRAM_MANAGER_H_
6 #define COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/lazy_instance.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 metrics {
20
21 // TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.*
22 // files into components/android/cronet.
23 //
24 // A HistogramManager instance is created by Android. It is the central
25 // controller for the acquisition of log data, and the automatic transmission of
26 // that log data to an external server.
27 class HistogramManager : public base::HistogramFlattener {
28 public:
29 HistogramManager();
30 ~HistogramManager() override;
31
32 // Snapshot all histograms to record the delta into |uma_proto_| and then
33 // returns the serialized protobuf representation of the record in |data|.
34 // Returns true if it was successfully serialized.
35 bool GetDeltas(std::vector<uint8>* data);
36
37 // TODO(mef): Hang Histogram Manager off java object instead of singleton.
38 static HistogramManager* GetInstance();
39
40 private:
41 friend struct base::DefaultLazyInstanceTraits<HistogramManager>;
42
43 // base::HistogramFlattener:
44 void RecordDelta(const base::HistogramBase& histogram,
45 const base::HistogramSamples& snapshot) override;
46 void InconsistencyDetected(
47 base::HistogramBase::Inconsistency problem) override;
48 void UniqueInconsistencyDetected(
49 base::HistogramBase::Inconsistency problem) override;
50 void InconsistencyDetectedInLoggedCount(int amount) override;
51
52 base::HistogramSnapshotManager histogram_snapshot_manager_;
53
54 // Stores the protocol buffer representation for this log.
55 metrics::ChromeUserMetricsExtension uma_proto_;
56
57 DISALLOW_COPY_AND_ASSIGN(HistogramManager);
58 };
59
60 } // namespace metrics
61
62 #endif // COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/histogram_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698