Chromium Code Reviews| Index: base/metrics/persistent_sample_map.h |
| diff --git a/base/metrics/persistent_sample_map.h b/base/metrics/persistent_sample_map.h |
| index 6cde349390db6acfd7cdf5771b847a505e3253af..10be75f22cc3b7ca2261e6d70cd8cb06b4614639 100644 |
| --- a/base/metrics/persistent_sample_map.h |
| +++ b/base/metrics/persistent_sample_map.h |
| @@ -15,6 +15,7 @@ |
| #include <memory> |
| #include "base/compiler_specific.h" |
| +#include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/metrics/histogram_base.h" |
| #include "base/metrics/histogram_samples.h" |
| @@ -81,7 +82,12 @@ class BASE_EXPORT PersistentSampleMap : public HistogramSamples { |
| HistogramBase::Sample value); |
| private: |
| - enum : HistogramBase::Sample { kAllSamples = -1 }; |
| + FRIEND_TEST_ALL_PREFIXES(PersistentSampleMapTest, PersistenceTest); |
| + |
| + // Since all values are possible in a SparseHistogram, the value of |
| + // kAllSamples is chosen to be something unlikely. In the case that this |
| + // value is used within the sample map, it is still safe. |
| + enum : HistogramBase::Sample { kAllSamples = -10000 }; |
|
Alexei Svitkine (slow)
2016/04/20 21:51:18
Can we avoid having this constant completely? For
Alexei Svitkine (slow)
2016/04/20 21:51:55
Or a separate boolean parameter?
bcwhite
2016/04/21 10:33:15
Sure, though the two parameters would generally be
|
| // Imports samples from persistent memory by iterating over all sample |
| // records found therein, adding them to the sample_counts_ map. If a |