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

Unified Diff: base/metrics/persistent_histogram_allocator_unittest.cc

Issue 1803253002: Improved iterator for persistent memory allocator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-hp
Patch Set: rebased Created 4 years, 8 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/persistent_histogram_allocator.cc ('k') | base/metrics/persistent_memory_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_histogram_allocator_unittest.cc
diff --git a/base/metrics/persistent_histogram_allocator_unittest.cc b/base/metrics/persistent_histogram_allocator_unittest.cc
index 4f0d44689015c6f0d4df85a2512567fc7aed9354..24a0753fe48cfb78901aac4f84b24dc16ccd103a 100644
--- a/base/metrics/persistent_histogram_allocator_unittest.cc
+++ b/base/metrics/persistent_histogram_allocator_unittest.cc
@@ -86,40 +86,38 @@ TEST_F(PersistentHistogramAllocatorTest, CreateAndIterateTest) {
allocator_->GetMemoryInfo(&meminfo4);
EXPECT_GT(meminfo3.free, meminfo4.free);
- PersistentMemoryAllocator::Iterator iter;
+ PersistentMemoryAllocator::Iterator iter(allocator_);
uint32_t type;
- allocator_->CreateIterator(&iter);
- EXPECT_NE(0U, allocator_->GetNextIterable(&iter, &type)); // Histogram
- EXPECT_NE(0U, allocator_->GetNextIterable(&iter, &type)); // LinearHistogram
- EXPECT_NE(0U, allocator_->GetNextIterable(&iter, &type)); // BooleanHistogram
- EXPECT_NE(0U, allocator_->GetNextIterable(&iter, &type)); // CustomHistogram
- EXPECT_EQ(0U, allocator_->GetNextIterable(&iter, &type));
+ EXPECT_NE(0U, iter.GetNext(&type)); // Histogram
+ EXPECT_NE(0U, iter.GetNext(&type)); // LinearHistogram
+ EXPECT_NE(0U, iter.GetNext(&type)); // BooleanHistogram
+ EXPECT_NE(0U, iter.GetNext(&type)); // CustomHistogram
+ EXPECT_EQ(0U, iter.GetNext(&type));
// Create a second allocator and have it access the memory of the first.
std::unique_ptr<HistogramBase> recovered;
PersistentHistogramAllocator recovery(
WrapUnique(new PersistentMemoryAllocator(
allocator_memory_.get(), kAllocatorMemorySize, 0, 0, "", false)));
- PersistentHistogramAllocator::Iterator histogram_iter;
- recovery.CreateIterator(&histogram_iter);
+ PersistentHistogramAllocator::Iterator histogram_iter(&recovery);
- recovered = recovery.GetNextHistogram(&histogram_iter);
+ recovered = histogram_iter.GetNext();
ASSERT_TRUE(recovered);
recovered->CheckName("TestHistogram");
- recovered = recovery.GetNextHistogram(&histogram_iter);
+ recovered = histogram_iter.GetNext();
ASSERT_TRUE(recovered);
recovered->CheckName("TestLinearHistogram");
- recovered = recovery.GetNextHistogram(&histogram_iter);
+ recovered = histogram_iter.GetNext();
ASSERT_TRUE(recovered);
recovered->CheckName("TestBooleanHistogram");
- recovered = recovery.GetNextHistogram(&histogram_iter);
+ recovered = histogram_iter.GetNext();
ASSERT_TRUE(recovered);
recovered->CheckName("TestCustomHistogram");
- recovered = recovery.GetNextHistogram(&histogram_iter);
+ recovered = histogram_iter.GetNext();
EXPECT_FALSE(recovered);
}
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | base/metrics/persistent_memory_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698