Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_RAPPOR_SAMPLER_H_ | |
| 6 #define COMPONENTS_RAPPOR_SAMPLER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/containers/scoped_ptr_hash_map.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "components/rappor/rappor_parameters.h" | |
| 15 #include "components/rappor/sample.h" | |
| 16 | |
| 17 namespace rappor { | |
| 18 | |
| 19 class RapporReports; | |
| 20 | |
| 21 class Sampler { | |
|
Alexei Svitkine (slow)
2015/04/16 15:09:44
Comment.
Steven Holte
2015/04/22 19:24:28
Done.
| |
| 22 public: | |
| 23 Sampler(); | |
| 24 ~Sampler(); | |
| 25 | |
| 26 void AddSample(const std::string& metric_name, scoped_ptr<Sample> sample); | |
| 27 void ExportMetrics(const std::string& secret, RapporReports* reports); | |
| 28 private: | |
| 29 std::map<std::string, int> sample_counts_; | |
| 30 | |
| 31 // We keep all registered metrics in a map, from name to metric. | |
| 32 // The map owns the metrics it contains. | |
| 33 base::ScopedPtrHashMap<std::string, Sample> samples_; | |
| 34 DISALLOW_COPY_AND_ASSIGN(Sampler); | |
|
Alexei Svitkine (slow)
2015/04/16 15:09:43
Blank line above.
Steven Holte
2015/04/22 19:24:28
Done.
| |
| 35 }; | |
| 36 | |
| 37 } // namespace rappor | |
| 38 | |
| 39 #endif // COMPONENTS_RAPPOR_SAMPLER_H_ | |
| OLD | NEW |