| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | |
| 6 #define CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/metrics/histogram_base.h" | |
| 10 #include "base/metrics/histogram_flattener.h" | |
| 11 #include "base/metrics/histogram_snapshot_manager.h" | |
| 12 #include "components/metrics/metrics_log_manager.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class HistogramSamples; | |
| 16 } // namespace base | |
| 17 | |
| 18 // This class provides base functionality for logging metrics data. | |
| 19 // TODO(ananta): Factor out more common code from chrome and chrome frame | |
| 20 // metrics service into this class. | |
| 21 class MetricsServiceBase : public base::HistogramFlattener { | |
| 22 public: | |
| 23 // HistogramFlattener interface (override) methods. | |
| 24 virtual void RecordDelta(const base::HistogramBase& histogram, | |
| 25 const base::HistogramSamples& snapshot) OVERRIDE; | |
| 26 virtual void InconsistencyDetected( | |
| 27 base::HistogramBase::Inconsistency problem) OVERRIDE; | |
| 28 virtual void UniqueInconsistencyDetected( | |
| 29 base::HistogramBase::Inconsistency problem) OVERRIDE; | |
| 30 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; | |
| 31 | |
| 32 protected: | |
| 33 // The metrics service will persist it's unsent logs by storing them in | |
| 34 // |local_state|, and will not persist ongoing logs over | |
| 35 // |max_ongoing_log_size|. | |
| 36 MetricsServiceBase(PrefService* local_state, size_t max_ongoing_log_size); | |
| 37 virtual ~MetricsServiceBase(); | |
| 38 | |
| 39 // The metrics server's URL. | |
| 40 static const char kServerUrl[]; | |
| 41 | |
| 42 // The MIME type for the uploaded metrics data. | |
| 43 static const char kMimeType[]; | |
| 44 | |
| 45 // Record complete list of histograms into the current log. | |
| 46 // Called when we close a log. | |
| 47 void RecordCurrentHistograms(); | |
| 48 | |
| 49 // Record complete list of stability histograms into the current log, | |
| 50 // i.e., histograms with the |kUmaStabilityHistogramFlag| flag set. | |
| 51 void RecordCurrentStabilityHistograms(); | |
| 52 | |
| 53 // Manager for the various in-flight logs. | |
| 54 metrics::MetricsLogManager log_manager_; | |
| 55 | |
| 56 private: | |
| 57 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. | |
| 58 base::HistogramSnapshotManager histogram_snapshot_manager_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); | |
| 61 }; | |
| 62 | |
| 63 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ | |
| OLD | NEW |