Chromium Code Reviews| 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_RAPPOR_RAPPOR_SERVICE_H_ | 5 #ifndef COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ |
| 6 #define COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ | 6 #define COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 class LogUploader; | 26 class LogUploader; |
| 27 class RapporMetric; | 27 class RapporMetric; |
| 28 class RapporReports; | 28 class RapporReports; |
| 29 struct RapporParameters; | 29 struct RapporParameters; |
| 30 | 30 |
| 31 // The type of data stored in a metric. | 31 // The type of data stored in a metric. |
| 32 enum RapporType { | 32 enum RapporType { |
| 33 // For sampling the eTLD+1 of a URL. | 33 // For sampling the eTLD+1 of a URL. |
| 34 ETLD_PLUS_ONE_RAPPOR_TYPE = 0, | 34 ETLD_PLUS_ONE_RAPPOR_TYPE = 0, |
| 35 FULL_POPULATION_RAPPOR_TYPE, | |
| 35 NUM_RAPPOR_TYPES | 36 NUM_RAPPOR_TYPES |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 // This class provides an interface for recording samples for rappor metrics, | 39 // This class provides an interface for recording samples for rappor metrics, |
| 39 // and periodically generates and uploads reports based on the collected data. | 40 // and periodically generates and uploads reports based on the collected data. |
| 40 class RapporService { | 41 class RapporService { |
| 41 public: | 42 public: |
| 42 // Constructs a RapporService. | 43 // Constructs a RapporService. |
| 43 // Calling code is responsible for ensuring that the lifetime of | 44 // Calling code is responsible for ensuring that the lifetime of |
| 44 // |pref_service| is longer than the lifetime of RapporService. | 45 // |pref_service| is longer than the lifetime of RapporService. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 115 |
| 115 // Timer which schedules calls to OnLogInterval(). | 116 // Timer which schedules calls to OnLogInterval(). |
| 116 base::OneShotTimer<RapporService> log_rotation_timer_; | 117 base::OneShotTimer<RapporService> log_rotation_timer_; |
| 117 | 118 |
| 118 // A daily event for collecting metrics once a day. | 119 // A daily event for collecting metrics once a day. |
| 119 metrics::DailyEvent daily_event_; | 120 metrics::DailyEvent daily_event_; |
| 120 | 121 |
| 121 // A private LogUploader instance for sending reports to the server. | 122 // A private LogUploader instance for sending reports to the server. |
| 122 scoped_ptr<LogUploader> uploader_; | 123 scoped_ptr<LogUploader> uploader_; |
| 123 | 124 |
| 125 // True if we are collecting all metrics instead of only whitelisted ones. | |
|
Alexei Svitkine (slow)
2014/11/03 21:48:21
Can you expand this comment to give a concrete use
Steven Holte
2014/11/04 02:44:20
Replaced this with a ReportingLevel.
| |
| 126 bool all_metrics_enabled_; | |
| 127 | |
| 124 // We keep all registered metrics in a map, from name to metric. | 128 // We keep all registered metrics in a map, from name to metric. |
| 125 // The map owns the metrics it contains. | 129 // The map owns the metrics it contains. |
| 126 std::map<std::string, RapporMetric*> metrics_map_; | 130 std::map<std::string, RapporMetric*> metrics_map_; |
| 127 | 131 |
| 128 DISALLOW_COPY_AND_ASSIGN(RapporService); | 132 DISALLOW_COPY_AND_ASSIGN(RapporService); |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 } // namespace rappor | 135 } // namespace rappor |
| 132 | 136 |
| 133 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ | 137 #endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_ |
| OLD | NEW |