Chromium Code Reviews| Index: base/metrics/histogram_persistence.cc |
| diff --git a/base/metrics/histogram_persistence.cc b/base/metrics/histogram_persistence.cc |
| index 535d11409276ea117357676c64061ca7c3eb3f7b..75df2860ed8d639d7eb56950fe09af7d6d95a576 100644 |
| --- a/base/metrics/histogram_persistence.cc |
| +++ b/base/metrics/histogram_persistence.cc |
| @@ -53,6 +53,9 @@ enum CreateHistogramResultType { |
| CREATE_HISTOGRAM_MAX |
| }; |
| +// Name of histogram for storing results of local operations. |
| +const char kResultHistogram[] = "UMA.CreatePersistentHistogram.Result"; |
| + |
| // Type identifiers used when storing in persistent memory so they can be |
| // identified during extraction; the first 4 bytes of the SHA1 of the name |
| // is used as a unique integer. A "version number" is added to the base |
| @@ -159,8 +162,7 @@ HistogramBase* GetCreateHistogramResultHistogram() { |
| } |
| histogram_pointer = LinearHistogram::FactoryGet( |
| - "UMA.CreatePersistentHistogram.Result", |
| - 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1, |
| + kResultHistogram, 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1, |
| HistogramBase::kUmaTargetedHistogramFlag); |
| base::subtle::Release_Store( |
| &atomic_histogram_pointer, |
| @@ -210,6 +212,10 @@ ReleasePersistentHistogramMemoryAllocatorForTesting() { |
| ref, kTypeIdHistogram); |
| DCHECK(histogram_data); |
| StatisticsRecorder::ForgetHistogramForTesting(histogram_data->name); |
| + |
| + // Fix by calling GetCreateHistogramResultHistogram() before setting |
|
Alexei Svitkine (slow)
2016/02/19 16:57:00
I don't understand this comment. Is it meant to be
bcwhite
2016/02/19 19:50:14
Done.
|
| + // the (temporary) persistent memory allocator. |
| + DCHECK_NE(kResultHistogram, histogram_data->name); |
| } |
| } |
| @@ -480,7 +486,7 @@ HistogramBase* AllocatePersistentHistogram( |
| void ImportPersistentHistograms() { |
| // The lock protects against concurrent access to the iterator and is created |
| // in a thread-safe manner when needed. |
| - static base::LazyInstance<base::Lock> lock = LAZY_INSTANCE_INITIALIZER; |
| + static base::LazyInstance<base::Lock>::Leaky lock = LAZY_INSTANCE_INITIALIZER; |
| if (g_allocator) { |
| base::AutoLock auto_lock(lock.Get()); |
| @@ -492,7 +498,7 @@ void ImportPersistentHistograms() { |
| if (iter.is_clear()) |
| g_allocator->CreateIterator(&iter); |
| - for (;;) { |
| + while (true) { |
| HistogramBase* histogram = GetNextPersistentHistogram(g_allocator, &iter); |
| if (!histogram) |
| break; |