| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "chrome/common/metrics/histogram_sender.h" | 11 #include "base/metrics/histogram_sender.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 HistogramSender { | 17 class MetricsServiceBase : public base::HistogramSender { |
| 18 protected: | 18 protected: |
| 19 MetricsServiceBase(); | 19 MetricsServiceBase(); |
| 20 virtual ~MetricsServiceBase(); | 20 virtual ~MetricsServiceBase(); |
| 21 | 21 |
| 22 // The metrics servers' URLs, for XML and protobuf uploads. | 22 // The metrics servers' URLs, for XML and protobuf uploads. |
| 23 static const char kServerUrlXml[]; | 23 static const char kServerUrlXml[]; |
| 24 static const char kServerUrlProto[]; | 24 static const char kServerUrlProto[]; |
| 25 | 25 |
| 26 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. | 26 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. |
| 27 static const char kMimeTypeXml[]; | 27 static const char kMimeTypeXml[]; |
| 28 static const char kMimeTypeProto[]; | 28 static const char kMimeTypeProto[]; |
| 29 | 29 |
| 30 // Record complete list of histograms into the current log. | 30 // Record complete list of histograms into the current log. |
| 31 // Called when we close a log. | 31 // Called when we close a log. |
| 32 void RecordCurrentHistograms(); | 32 void RecordCurrentHistograms(); |
| 33 | 33 |
| 34 // Manager for the various in-flight logs. | 34 // Manager for the various in-flight logs. |
| 35 MetricsLogManager log_manager_; | 35 MetricsLogManager log_manager_; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // HistogramSender interface (override) methods. | 38 // HistogramSender interface (override) methods. |
| 39 virtual void SendHistograms(int sequence_number) OVERRIDE; |
| 39 virtual void TransmitHistogramDelta( | 40 virtual void TransmitHistogramDelta( |
| 40 const base::Histogram& histogram, | 41 const base::Histogram& histogram, |
| 41 const base::Histogram::SampleSet& snapshot) OVERRIDE; | 42 const base::Histogram::SampleSet& snapshot) OVERRIDE; |
| 42 virtual void InconsistencyDetected(int problem) OVERRIDE; | 43 virtual void InconsistencyDetected(int problem) OVERRIDE; |
| 43 virtual void UniqueInconsistencyDetected(int problem) OVERRIDE; | 44 virtual void UniqueInconsistencyDetected(int problem) OVERRIDE; |
| 44 virtual void SnapshotProblemResolved(int amount) OVERRIDE; | 45 virtual void SnapshotProblemResolved(int amount) OVERRIDE; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); | 47 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | 50 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ |
| OLD | NEW |