Chromium Code Reviews| 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 51d36e978683cec562cf1e94644cd8f266eabc0d..6058f470e9d654b69d8178734e3be1d0af0f4577 100644 |
| --- a/base/trace_event/heap_profiler_allocation_register_unittest.cc |
| +++ b/base/trace_event/heap_profiler_allocation_register_unittest.cc |
| @@ -14,6 +14,7 @@ |
| 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. |
| @@ -23,10 +24,6 @@ |
| uint32_t GetHighWaterMark(const AllocationRegister& reg) { |
| return reg.next_unused_cell_; |
| - } |
| - |
| - uint32_t GetNumCells(const AllocationRegister& reg) { |
| - return reg.num_cells_; |
| } |
| }; |
| @@ -206,15 +203,14 @@ |
| // too many elements. |
| #if GTEST_HAS_DEATH_TEST |
| TEST_F(AllocationRegisterTest, OverflowDeathTest) { |
| - // Use a smaller register to prevent OOM errors on low-end devices. |
| - AllocationRegister reg(GetNumCellsPerPage()); |
|
Ruud van Asseldonk
2015/12/18 09:24:27
It might be simpler to just fix the bug and explic
|
| + AllocationRegister reg; |
| AllocationContext ctx = AllocationContext::Empty(); |
| uintptr_t 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++) { |
| + // 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++) { |
| reg.Insert(reinterpret_cast<void*>(i), 0, ctx); |
| } |