| 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(int problem) OVERRIDE; |
| 23 virtual void UniqueInconsistencyDetected(int problem) OVERRIDE; | 23 virtual void UniqueInconsistencyDetected(int problem) OVERRIDE; |
| 24 virtual void SnapshotProblemResolved(int amount) OVERRIDE; | 24 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 MetricsServiceBase(); | 27 MetricsServiceBase(); |
| 28 virtual ~MetricsServiceBase(); | 28 virtual ~MetricsServiceBase(); |
| 29 | 29 |
| 30 // The metrics servers' URLs, for XML and protobuf uploads. | 30 // The metrics servers' URLs, for XML and protobuf uploads. |
| 31 static const char kServerUrlXml[]; | 31 static const char kServerUrlXml[]; |
| 32 static const char kServerUrlProto[]; | 32 static const char kServerUrlProto[]; |
| 33 | 33 |
| 34 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. | 34 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. |
| 35 static const char kMimeTypeXml[]; | 35 static const char kMimeTypeXml[]; |
| 36 static const char kMimeTypeProto[]; | 36 static const char kMimeTypeProto[]; |
| 37 | 37 |
| 38 // Record complete list of histograms into the current log. | 38 // Record complete list of histograms into the current log. |
| 39 // Called when we close a log. | 39 // Called when we close a log. |
| 40 void RecordCurrentHistograms(); | 40 void RecordCurrentHistograms(); |
| 41 | 41 |
| 42 // Manager for the various in-flight logs. | 42 // Manager for the various in-flight logs. |
| 43 MetricsLogManager log_manager_; | 43 MetricsLogManager log_manager_; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. | 46 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. |
| 47 base::HistogramSnapshotManager histogram_snapshot_manager_; | 47 base::HistogramSnapshotManager histogram_snapshot_manager_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); | 49 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | 52 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ |
| OLD | NEW |