| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/debug/thread_heap_usage_tracker.h" | 5 #include "base/debug/thread_heap_usage_tracker.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_shim.h" | 9 #include "base/allocator/allocator_shim.h" |
| 10 #include "base/allocator/features.h" | 10 #include "base/allocator/features.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 { | 199 { |
| 200 &ThreadHeapUsageTrackerTest::OnAllocFn, // alloc_function | 200 &ThreadHeapUsageTrackerTest::OnAllocFn, // alloc_function |
| 201 &ThreadHeapUsageTrackerTest:: | 201 &ThreadHeapUsageTrackerTest:: |
| 202 OnAllocZeroInitializedFn, // alloc_zero_initialized_function | 202 OnAllocZeroInitializedFn, // alloc_zero_initialized_function |
| 203 &ThreadHeapUsageTrackerTest:: | 203 &ThreadHeapUsageTrackerTest:: |
| 204 OnAllocAlignedFn, // alloc_aligned_function | 204 OnAllocAlignedFn, // alloc_aligned_function |
| 205 &ThreadHeapUsageTrackerTest::OnReallocFn, // realloc_function | 205 &ThreadHeapUsageTrackerTest::OnReallocFn, // realloc_function |
| 206 &ThreadHeapUsageTrackerTest::OnFreeFn, // free_function | 206 &ThreadHeapUsageTrackerTest::OnFreeFn, // free_function |
| 207 &ThreadHeapUsageTrackerTest:: | 207 &ThreadHeapUsageTrackerTest:: |
| 208 OnGetSizeEstimateFn, // get_size_estimate_function | 208 OnGetSizeEstimateFn, // get_size_estimate_function |
| 209 nullptr, // batch_malloc |
| 210 nullptr, // batch_free |
| 209 nullptr, // next | 211 nullptr, // next |
| 210 }; | 212 }; |
| 211 | 213 |
| 212 } // namespace | 214 } // namespace |
| 213 | 215 |
| 214 TEST_F(ThreadHeapUsageTrackerTest, SimpleUsageWithExactSizeFunction) { | 216 TEST_F(ThreadHeapUsageTrackerTest, SimpleUsageWithExactSizeFunction) { |
| 215 set_size_function_kind(EXACT_SIZE_FUNCTION); | 217 set_size_function_kind(EXACT_SIZE_FUNCTION); |
| 216 | 218 |
| 217 ThreadHeapUsageTracker usage_tracker; | 219 ThreadHeapUsageTracker usage_tracker; |
| 218 usage_tracker.Start(); | 220 usage_tracker.Start(); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 EXPECT_LE(u2.free_ops + 1, u3.free_ops); | 577 EXPECT_LE(u2.free_ops + 1, u3.free_ops); |
| 576 | 578 |
| 577 TestingThreadHeapUsageTracker::DisableHeapTrackingForTesting(); | 579 TestingThreadHeapUsageTracker::DisableHeapTrackingForTesting(); |
| 578 | 580 |
| 579 ASSERT_FALSE(ThreadHeapUsageTracker::IsHeapTrackingEnabled()); | 581 ASSERT_FALSE(ThreadHeapUsageTracker::IsHeapTrackingEnabled()); |
| 580 } | 582 } |
| 581 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) | 583 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
| 582 | 584 |
| 583 } // namespace debug | 585 } // namespace debug |
| 584 } // namespace base | 586 } // namespace base |
| OLD | NEW |