| Index: base/trace_event/heap_profiler_allocation_register_unittest.cc
|
| diff --git a/base/trace_event/heap_profiler_allocation_register_unittest.cc b/base/trace_event/heap_profiler_allocation_register_unittest.cc
|
| index 6058f470e9d654b69d8178734e3be1d0af0f4577..51d36e978683cec562cf1e94644cd8f266eabc0d 100644
|
| --- a/base/trace_event/heap_profiler_allocation_register_unittest.cc
|
| +++ b/base/trace_event/heap_profiler_allocation_register_unittest.cc
|
| @@ -14,7 +14,6 @@ namespace trace_event {
|
| class AllocationRegisterTest : public testing::Test {
|
| public:
|
| static const uint32_t kNumBuckets = AllocationRegister::kNumBuckets;
|
| - static const uint32_t kNumCells = AllocationRegister::kNumCells;
|
|
|
| // Returns the number of cells that the |AllocationRegister| can store per
|
| // system page.
|
| @@ -25,6 +24,10 @@ class AllocationRegisterTest : public testing::Test {
|
| uint32_t GetHighWaterMark(const AllocationRegister& reg) {
|
| return reg.next_unused_cell_;
|
| }
|
| +
|
| + uint32_t GetNumCells(const AllocationRegister& reg) {
|
| + return reg.num_cells_;
|
| + }
|
| };
|
|
|
| // Iterates over all entries in the allocation register and returns the bitwise
|
| @@ -203,14 +206,15 @@ TEST_F(AllocationRegisterTest, InsertRemoveRandomOrder) {
|
| // too many elements.
|
| #if GTEST_HAS_DEATH_TEST
|
| TEST_F(AllocationRegisterTest, OverflowDeathTest) {
|
| - AllocationRegister reg;
|
| + // Use a smaller register to prevent OOM errors on low-end devices.
|
| + AllocationRegister reg(GetNumCellsPerPage());
|
| AllocationContext ctx = AllocationContext::Empty();
|
| uintptr_t i;
|
|
|
| - // Fill up all of the memory allocated for the register. |kNumCells| minus 1
|
| - // elements are inserted, because cell 0 is unused, so this should fill up
|
| - // the available cells exactly.
|
| - for (i = 1; i < kNumCells; i++) {
|
| + // Fill up all of the memory allocated for the register. |GetNumCells(reg)|
|
| + // minus 1 elements are inserted, because cell 0 is unused, so this should
|
| + // fill up the available cells exactly.
|
| + for (i = 1; i < GetNumCells(reg); i++) {
|
| reg.Insert(reinterpret_cast<void*>(i), 0, ctx);
|
| }
|
|
|
|
|