Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: base/metrics/histogram_unittest.cc

Issue 1734033003: Add support for persistent sparse histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/persistent_histogram_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_unittest.cc
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
index f621ec5b6ac0b9a31816ebd9720aa4b3e10fd798..03dc7bda8b912f9ab30ca03e54459303e8829c02 100644
--- a/base/metrics/histogram_unittest.cc
+++ b/base/metrics/histogram_unittest.cc
@@ -37,11 +37,12 @@ class HistogramTest : public testing::TestWithParam<bool> {
HistogramTest() : use_persistent_histogram_allocator_(GetParam()) {}
void SetUp() override {
+ if (use_persistent_histogram_allocator_)
+ CreatePersistentHistogramAllocator();
+
// Each test will have a clean state (no Histogram / BucketRanges
// registered).
InitializeStatisticsRecorder();
- if (use_persistent_histogram_allocator_)
- CreatePersistentHistogramAllocator();
}
void TearDown() override {
@@ -69,14 +70,8 @@ class HistogramTest : public testing::TestWithParam<bool> {
// any persistent memory segment (which simplifies some tests).
PersistentHistogramAllocator::GetCreateHistogramResultHistogram();
- if (!allocator_memory_)
- allocator_memory_.reset(new char[kAllocatorMemorySize]);
-
- PersistentHistogramAllocator::ReleaseGlobalAllocatorForTesting();
- memset(allocator_memory_.get(), 0, kAllocatorMemorySize);
- PersistentHistogramAllocator::CreateGlobalAllocatorOnPersistentMemory(
- allocator_memory_.get(), kAllocatorMemorySize, 0, 0,
- "HistogramAllocatorTest");
+ PersistentHistogramAllocator::CreateGlobalAllocatorOnLocalMemory(
+ kAllocatorMemorySize, 0, "HistogramAllocatorTest");
allocator_ =
PersistentHistogramAllocator::GetGlobalAllocator()->memory_allocator();
}
« no previous file with comments | « base/metrics/histogram.cc ('k') | base/metrics/persistent_histogram_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698