| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SAMPLER_H_ | 5 #ifndef COMPONENTS_RAPPOR_SAMPLER_H_ |
| 6 #define COMPONENTS_RAPPOR_SAMPLER_H_ | 6 #define COMPONENTS_RAPPOR_SAMPLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <unordered_map> |
| 11 | 12 |
| 12 #include "base/containers/scoped_ptr_hash_map.h" | |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "components/rappor/public/rappor_parameters.h" | 14 #include "components/rappor/public/rappor_parameters.h" |
| 15 #include "components/rappor/public/sample.h" | 15 #include "components/rappor/public/sample.h" |
| 16 | 16 |
| 17 namespace rappor { | 17 namespace rappor { |
| 18 | 18 |
| 19 class RapporReports; | 19 class RapporReports; |
| 20 | 20 |
| 21 namespace internal { | 21 namespace internal { |
| 22 | 22 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Generate randomized reports for all stored samples and store them | 36 // Generate randomized reports for all stored samples and store them |
| 37 // in |reports|, then discard the samples. | 37 // in |reports|, then discard the samples. |
| 38 void ExportMetrics(const std::string& secret, RapporReports* reports); | 38 void ExportMetrics(const std::string& secret, RapporReports* reports); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // The number of samples recorded for each metric since the last export. | 41 // The number of samples recorded for each metric since the last export. |
| 42 std::map<std::string, int> sample_counts_; | 42 std::map<std::string, int> sample_counts_; |
| 43 | 43 |
| 44 // Stores a Sample for each metric, by metric name. | 44 // Stores a Sample for each metric, by metric name. |
| 45 base::ScopedPtrHashMap<std::string, std::unique_ptr<Sample>> samples_; | 45 std::unordered_map<std::string, std::unique_ptr<Sample>> samples_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(Sampler); | 47 DISALLOW_COPY_AND_ASSIGN(Sampler); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace internal | 50 } // namespace internal |
| 51 | 51 |
| 52 } // namespace rappor | 52 } // namespace rappor |
| 53 | 53 |
| 54 #endif // COMPONENTS_RAPPOR_SAMPLER_H_ | 54 #endif // COMPONENTS_RAPPOR_SAMPLER_H_ |
| OLD | NEW |