| OLD | NEW |
| 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_METRICS_HISTOGRAM_MANAGER_H_ | 5 #ifndef COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_ |
| 6 #define COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_ | 6 #define COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/histogram_flattener.h" | 15 #include "base/metrics/histogram_flattener.h" |
| 16 #include "base/metrics/histogram_snapshot_manager.h" | 16 #include "base/metrics/histogram_snapshot_manager.h" |
| 17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 18 | 18 |
| 19 namespace metrics { | 19 namespace metrics { |
| 20 | 20 |
| 21 // TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.* | 21 // TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.* |
| 22 // files into components/android/cronet. | 22 // files into components/android/cronet. |
| 23 // | 23 // |
| 24 // A HistogramManager instance is created by Android. It is the central | 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 | 25 // controller for the acquisition of log data, and the automatic transmission of |
| 26 // that log data to an external server. | 26 // that log data to an external server. |
| 27 class HistogramManager : public base::HistogramFlattener { | 27 class HistogramManager : public base::HistogramFlattener { |
| 28 public: | 28 public: |
| 29 HistogramManager(); | 29 HistogramManager(); |
| 30 ~HistogramManager(); | 30 ~HistogramManager() override; |
| 31 | 31 |
| 32 // Snapshot all histograms to record the delta into |uma_proto_| and then | 32 // Snapshot all histograms to record the delta into |uma_proto_| and then |
| 33 // returns the serialized protobuf representation of the record in |data|. | 33 // returns the serialized protobuf representation of the record in |data|. |
| 34 // Returns true if it was successfully serialized. | 34 // Returns true if it was successfully serialized. |
| 35 bool GetDeltas(std::vector<uint8>* data); | 35 bool GetDeltas(std::vector<uint8>* data); |
| 36 | 36 |
| 37 // TODO(mef): Hang Histogram Manager off java object instead of singleton. | 37 // TODO(mef): Hang Histogram Manager off java object instead of singleton. |
| 38 static HistogramManager* GetInstance(); | 38 static HistogramManager* GetInstance(); |
| 39 | 39 |
| 40 private: | 40 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 | 53 |
| 54 // Stores the protocol buffer representation for this log. | 54 // Stores the protocol buffer representation for this log. |
| 55 metrics::ChromeUserMetricsExtension uma_proto_; | 55 metrics::ChromeUserMetricsExtension uma_proto_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(HistogramManager); | 57 DISALLOW_COPY_AND_ASSIGN(HistogramManager); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace metrics | 60 } // namespace metrics |
| 61 | 61 |
| 62 #endif // COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_ | 62 #endif // COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_ |
| OLD | NEW |