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

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

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
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>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/basictypes.h"
12 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/metrics/histogram_flattener.h" 16 #include "base/metrics/histogram_flattener.h"
16 #include "base/metrics/histogram_snapshot_manager.h" 17 #include "base/metrics/histogram_snapshot_manager.h"
17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" 18 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
18 19
19 namespace cronet { 20 namespace cronet {
20 21
21 // A HistogramManager instance is created by the app. It is the central 22 // A HistogramManager instance is created by the app. It is the central
22 // controller for the acquisition of log data, and recording deltas for 23 // controller for the acquisition of log data, and recording deltas for
23 // transmission to an external server. 24 // transmission to an external server.
24 class HistogramManager : public base::HistogramFlattener { 25 class HistogramManager : public base::HistogramFlattener {
25 public: 26 public:
26 HistogramManager(); 27 HistogramManager();
27 ~HistogramManager() override; 28 ~HistogramManager() override;
28 29
29 // Snapshot all histograms to record the delta into |uma_proto_| and then 30 // Snapshot all histograms to record the delta into |uma_proto_| and then
30 // returns the serialized protobuf representation of the record in |data|. 31 // returns the serialized protobuf representation of the record in |data|.
31 // Returns true if it was successfully serialized. 32 // Returns true if it was successfully serialized.
32 bool GetDeltas(std::vector<uint8>* data); 33 bool GetDeltas(std::vector<uint8_t>* data);
33 34
34 // TODO(mef): Hang Histogram Manager off java object instead of singleton. 35 // TODO(mef): Hang Histogram Manager off java object instead of singleton.
35 static HistogramManager* GetInstance(); 36 static HistogramManager* GetInstance();
36 37
37 private: 38 private:
38 friend struct base::DefaultLazyInstanceTraits<HistogramManager>; 39 friend struct base::DefaultLazyInstanceTraits<HistogramManager>;
39 40
40 // base::HistogramFlattener: 41 // base::HistogramFlattener:
41 void RecordDelta(const base::HistogramBase& histogram, 42 void RecordDelta(const base::HistogramBase& histogram,
42 const base::HistogramSamples& snapshot) override; 43 const base::HistogramSamples& snapshot) override;
43 void InconsistencyDetected( 44 void InconsistencyDetected(
44 base::HistogramBase::Inconsistency problem) override; 45 base::HistogramBase::Inconsistency problem) override;
45 void UniqueInconsistencyDetected( 46 void UniqueInconsistencyDetected(
46 base::HistogramBase::Inconsistency problem) override; 47 base::HistogramBase::Inconsistency problem) override;
47 void InconsistencyDetectedInLoggedCount(int amount) override; 48 void InconsistencyDetectedInLoggedCount(int amount) override;
48 49
49 base::HistogramSnapshotManager histogram_snapshot_manager_; 50 base::HistogramSnapshotManager histogram_snapshot_manager_;
50 51
51 // Stores the protocol buffer representation for this log. 52 // Stores the protocol buffer representation for this log.
52 metrics::ChromeUserMetricsExtension uma_proto_; 53 metrics::ChromeUserMetricsExtension uma_proto_;
53 54
54 DISALLOW_COPY_AND_ASSIGN(HistogramManager); 55 DISALLOW_COPY_AND_ASSIGN(HistogramManager);
55 }; 56 };
56 57
57 } // namespace cronet 58 } // namespace cronet
58 59
59 #endif // COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_ 60 #endif // COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « components/cronet/android/wrapped_channel_upload_element_reader.cc ('k') | components/cronet/histogram_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698