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

Unified Diff: base/debug/thread_heap_usage_tracker_unittest.cc

Issue 2697123007: base: Add support for malloc zones to the allocator shim (Closed)
Patch Set: Windows compile error. Created 3 years, 10 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
Index: base/debug/thread_heap_usage_tracker_unittest.cc
diff --git a/base/debug/thread_heap_usage_tracker_unittest.cc b/base/debug/thread_heap_usage_tracker_unittest.cc
index 5c03c3853ee8fdfca2f144d057a1439c3578308b..2012e4971f021581cc574a6024ddb1f6dc701c39 100644
--- a/base/debug/thread_heap_usage_tracker_unittest.cc
+++ b/base/debug/thread_heap_usage_tracker_unittest.cc
@@ -68,31 +68,32 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
}
void* MockMalloc(size_t size) {
- return dispatch_under_test_->alloc_function(dispatch_under_test_, size);
+ return dispatch_under_test_->alloc_function(dispatch_under_test_, size,
+ nullptr);
}
void* MockCalloc(size_t n, size_t size) {
return dispatch_under_test_->alloc_zero_initialized_function(
- dispatch_under_test_, n, size);
+ dispatch_under_test_, n, size, nullptr);
}
void* MockAllocAligned(size_t alignment, size_t size) {
- return dispatch_under_test_->alloc_aligned_function(dispatch_under_test_,
- alignment, size);
+ return dispatch_under_test_->alloc_aligned_function(
+ dispatch_under_test_, alignment, size, nullptr);
}
void* MockRealloc(void* address, size_t size) {
return dispatch_under_test_->realloc_function(dispatch_under_test_, address,
- size);
+ size, nullptr);
}
void MockFree(void* address) {
- dispatch_under_test_->free_function(dispatch_under_test_, address);
+ dispatch_under_test_->free_function(dispatch_under_test_, address, nullptr);
}
size_t MockGetSizeEstimate(void* address) {
return dispatch_under_test_->get_size_estimate_function(
- dispatch_under_test_, address);
+ dispatch_under_test_, address, nullptr);
}
private:
@@ -126,7 +127,9 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
return ret;
}
- static void* OnAllocFn(const AllocatorDispatch* self, size_t size) {
+ static void* OnAllocFn(const AllocatorDispatch* self,
+ size_t size,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
void* ret = malloc(size);
@@ -136,7 +139,8 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
static void* OnAllocZeroInitializedFn(const AllocatorDispatch* self,
size_t n,
- size_t size) {
+ size_t size,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
void* ret = calloc(n, size);
@@ -146,7 +150,8 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
static void* OnAllocAlignedFn(const AllocatorDispatch* self,
size_t alignment,
- size_t size) {
+ size_t size,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
// This is a cheat as it doesn't return aligned allocations. This has the
@@ -158,7 +163,8 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
static void* OnReallocFn(const AllocatorDispatch* self,
void* address,
- size_t size) {
+ size_t size,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
g_self->DeleteAlloc(address);
@@ -167,7 +173,9 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
return ret;
}
- static void OnFreeFn(const AllocatorDispatch* self, void* address) {
+ static void OnFreeFn(const AllocatorDispatch* self,
+ void* address,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
g_self->DeleteAlloc(address);
@@ -175,7 +183,8 @@ class ThreadHeapUsageTrackerTest : public testing::Test {
}
static size_t OnGetSizeEstimateFn(const AllocatorDispatch* self,
- void* address) {
+ void* address,
+ void* context) {
EXPECT_EQ(&g_mock_dispatch, self);
return g_self->GetSizeEstimate(address);

Powered by Google App Engine
This is Rietveld 408576698