Index: base/metrics/histogram_unittest.cc |
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc |
index 784aaeb45a8ce0b0f70313fb380530a7514e20fd..70ce441a8b6d35ea11bdf1d4582ec9615f0c6a89 100644 |
--- a/base/metrics/histogram_unittest.cc |
+++ b/base/metrics/histogram_unittest.cc |
@@ -40,10 +40,6 @@ class HistogramTest : public testing::Test { |
// Each test will have a clean state (no Histogram / BucketRanges |
// registered). |
InitializeStatisticsRecorder(); |
- // By getting the results-histogram before any persistent allocator |
- // is attached, that histogram is guaranteed not to be stored in |
- // any persistent memory segment (which simplifies some tests). |
- GetCreateHistogramResultHistogram(); |
} |
void TearDown() override { |
@@ -62,10 +58,14 @@ class HistogramTest : public testing::Test { |
} |
void CreatePersistentMemoryAllocator() { |
+ // By getting the results-histogram before any persistent allocator |
+ // is attached, that histogram is guaranteed not to be stored in |
+ // any persistent memory segment (which simplifies some tests). |
+ GetCreateHistogramResultHistogram(); |
+ |
if (!allocator_memory_) |
allocator_memory_.reset(new char[kAllocatorMemorySize]); |
- SetPersistentHistogramMemoryAllocator(nullptr); |
memset(allocator_memory_.get(), 0, kAllocatorMemorySize); |
SetPersistentHistogramMemoryAllocator( |
new PersistentMemoryAllocator( |
@@ -76,7 +76,7 @@ class HistogramTest : public testing::Test { |
void DestroyPersistentMemoryAllocator() { |
allocator_ = nullptr; |
- SetPersistentHistogramMemoryAllocator(nullptr); |
+ delete ReleasePersistentHistogramMemoryAllocatorForTesting(); |
} |
StatisticsRecorder* statistics_recorder_; |