OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | 5 #ifndef CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ |
6 #define CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | 6 #define CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/histogram_flattener.h" | 10 #include "base/metrics/histogram_flattener.h" |
11 #include "base/metrics/histogram_snapshot_manager.h" | 11 #include "base/metrics/histogram_snapshot_manager.h" |
12 #include "chrome/common/metrics/metrics_log_manager.h" | 12 #include "chrome/common/metrics/metrics_log_manager.h" |
13 | 13 |
14 // This class provides base functionality for logging metrics data. | 14 // This class provides base functionality for logging metrics data. |
15 // TODO(ananta): Factor out more common code from chrome and chrome frame | 15 // TODO(ananta): Factor out more common code from chrome and chrome frame |
16 // metrics service into this class. | 16 // metrics service into this class. |
17 class MetricsServiceBase : public base::HistogramFlattener { | 17 class MetricsServiceBase : public base::HistogramFlattener { |
18 public: | 18 public: |
19 // HistogramFlattener interface (override) methods. | 19 // HistogramFlattener interface (override) methods. |
20 virtual void RecordDelta(const base::Histogram& histogram, | 20 virtual void RecordDelta(const base::Histogram& histogram, |
21 const base::Histogram::SampleSet& snapshot) OVERRIDE; | 21 const base::Histogram::SampleSet& snapshot) OVERRIDE; |
22 virtual void InconsistencyDetected(int problem) OVERRIDE; | 22 virtual void InconsistencyDetected( |
23 virtual void UniqueInconsistencyDetected(int problem) OVERRIDE; | 23 base::Histogram::Inconsistencies problem) OVERRIDE; |
24 virtual void SnapshotProblemResolved(int amount) OVERRIDE; | 24 virtual void UniqueInconsistencyDetected( |
| 25 base::Histogram::Inconsistencies problem) OVERRIDE; |
| 26 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; |
25 | 27 |
26 protected: | 28 protected: |
27 MetricsServiceBase(); | 29 MetricsServiceBase(); |
28 virtual ~MetricsServiceBase(); | 30 virtual ~MetricsServiceBase(); |
29 | 31 |
30 // The metrics servers' URLs, for XML and protobuf uploads. | 32 // The metrics servers' URLs, for XML and protobuf uploads. |
31 static const char kServerUrlXml[]; | 33 static const char kServerUrlXml[]; |
32 static const char kServerUrlProto[]; | 34 static const char kServerUrlProto[]; |
33 | 35 |
34 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. | 36 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. |
35 static const char kMimeTypeXml[]; | 37 static const char kMimeTypeXml[]; |
36 static const char kMimeTypeProto[]; | 38 static const char kMimeTypeProto[]; |
37 | 39 |
38 // Record complete list of histograms into the current log. | 40 // Record complete list of histograms into the current log. |
39 // Called when we close a log. | 41 // Called when we close a log. |
40 void RecordCurrentHistograms(); | 42 void RecordCurrentHistograms(); |
41 | 43 |
42 // Manager for the various in-flight logs. | 44 // Manager for the various in-flight logs. |
43 MetricsLogManager log_manager_; | 45 MetricsLogManager log_manager_; |
44 | 46 |
45 private: | 47 private: |
46 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. | 48 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. |
47 base::HistogramSnapshotManager histogram_snapshot_manager_; | 49 base::HistogramSnapshotManager histogram_snapshot_manager_; |
48 | 50 |
49 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); | 51 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); |
50 }; | 52 }; |
51 | 53 |
52 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | 54 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ |
OLD | NEW |