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

Unified Diff: base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.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/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc
diff --git a/base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc b/base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc
index bc1310060ded7f74b699cfe248ca7fc324f08644..aabda1950cb290a5b2659e7a370551aea9613f1a 100644
--- a/base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc
+++ b/base/allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc
@@ -20,49 +20,68 @@ namespace {
// malloc zone.
MallocZoneFunctions g_default_zone;
-void* MallocImpl(const AllocatorDispatch*, size_t size) {
- return g_default_zone.malloc(malloc_default_zone(), size);
+void* MallocImpl(const AllocatorDispatch*, size_t size, void* context) {
+ return g_default_zone.malloc(
+ reinterpret_cast<struct _malloc_zone_t*>(context), size);
}
-void* CallocImpl(const AllocatorDispatch*, size_t n, size_t size) {
- return g_default_zone.calloc(malloc_default_zone(), n, size);
+void* CallocImpl(const AllocatorDispatch*,
+ size_t n,
+ size_t size,
+ void* context) {
+ return g_default_zone.calloc(
+ reinterpret_cast<struct _malloc_zone_t*>(context), n, size);
}
-void* MemalignImpl(const AllocatorDispatch*, size_t alignment, size_t size) {
- return g_default_zone.memalign(malloc_default_zone(), alignment, size);
+void* MemalignImpl(const AllocatorDispatch*,
+ size_t alignment,
+ size_t size,
+ void* context) {
+ return g_default_zone.memalign(
+ reinterpret_cast<struct _malloc_zone_t*>(context), alignment, size);
}
-void* ReallocImpl(const AllocatorDispatch*, void* ptr, size_t size) {
- return g_default_zone.realloc(malloc_default_zone(), ptr, size);
+void* ReallocImpl(const AllocatorDispatch*,
+ void* ptr,
+ size_t size,
+ void* context) {
+ return g_default_zone.realloc(
+ reinterpret_cast<struct _malloc_zone_t*>(context), ptr, size);
}
-void FreeImpl(const AllocatorDispatch*, void* ptr) {
- g_default_zone.free(malloc_default_zone(), ptr);
+void FreeImpl(const AllocatorDispatch*, void* ptr, void* context) {
+ g_default_zone.free(reinterpret_cast<struct _malloc_zone_t*>(context), ptr);
}
-size_t GetSizeEstimateImpl(const AllocatorDispatch*, void* ptr) {
- return g_default_zone.size(malloc_default_zone(), ptr);
+size_t GetSizeEstimateImpl(const AllocatorDispatch*, void* ptr, void* context) {
+ return g_default_zone.size(reinterpret_cast<struct _malloc_zone_t*>(context),
+ ptr);
}
unsigned BatchMallocImpl(const AllocatorDispatch* self,
size_t size,
void** results,
- unsigned num_requested) {
- return g_default_zone.batch_malloc(malloc_default_zone(), size, results,
- num_requested);
+ unsigned num_requested,
+ void* context) {
+ return g_default_zone.batch_malloc(
+ reinterpret_cast<struct _malloc_zone_t*>(context), size, results,
+ num_requested);
}
void BatchFreeImpl(const AllocatorDispatch* self,
void** to_be_freed,
- unsigned num_to_be_freed) {
- g_default_zone.batch_free(malloc_default_zone(), to_be_freed,
- num_to_be_freed);
+ unsigned num_to_be_freed,
+ void* context) {
+ g_default_zone.batch_free(reinterpret_cast<struct _malloc_zone_t*>(context),
+ to_be_freed, num_to_be_freed);
}
void FreeDefiniteSizeImpl(const AllocatorDispatch* self,
void* ptr,
- size_t size) {
- g_default_zone.free_definite_size(malloc_default_zone(), ptr, size);
+ size_t size,
+ void* context) {
+ g_default_zone.free_definite_size(
+ reinterpret_cast<struct _malloc_zone_t*>(context), ptr, size);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698