Chromium Code Reviews| Index: base/allocator/allocator_interception_mac.h |
| diff --git a/base/allocator/allocator_interception_mac.h b/base/allocator/allocator_interception_mac.h |
| index ff9b0b1b85c76e19c498bc89cb2e9671ac07a87a..f0d945132baec8d837e182f922eaab5e6ad6be1b 100644 |
| --- a/base/allocator/allocator_interception_mac.h |
| +++ b/base/allocator/allocator_interception_mac.h |
| @@ -5,59 +5,24 @@ |
| #ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
| #define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
| -#include <malloc/malloc.h> |
| #include <stddef.h> |
| #include "base/base_export.h" |
| -#include "third_party/apple_apsl/malloc.h" |
| namespace base { |
| namespace allocator { |
| -typedef void* (*malloc_type)(struct _malloc_zone_t* zone, size_t size); |
| -typedef void* (*calloc_type)(struct _malloc_zone_t* zone, |
| - size_t num_items, |
| - size_t size); |
| -typedef void* (*valloc_type)(struct _malloc_zone_t* zone, size_t size); |
| -typedef void (*free_type)(struct _malloc_zone_t* zone, void* ptr); |
| -typedef void* (*realloc_type)(struct _malloc_zone_t* zone, |
| - void* ptr, |
| - size_t size); |
| -typedef void* (*memalign_type)(struct _malloc_zone_t* zone, |
| - size_t alignment, |
| - size_t size); |
| -typedef unsigned (*batch_malloc_type)(struct _malloc_zone_t* zone, |
| - size_t size, |
| - void** results, |
| - unsigned num_requested); |
| -typedef void (*batch_free_type)(struct _malloc_zone_t* zone, |
| - void** to_be_freed, |
| - unsigned num_to_be_freed); |
| -typedef void (*free_definite_size_type)(struct _malloc_zone_t* zone, |
| - void* ptr, |
| - size_t size); |
| -typedef size_t (*size_fn_type)(struct _malloc_zone_t* zone, const void* ptr); |
| +struct MallocZoneFunctions; |
| -struct MallocZoneFunctions { |
| - MallocZoneFunctions(); |
| - malloc_type malloc = nullptr; |
| - calloc_type calloc = nullptr; |
| - valloc_type valloc = nullptr; |
| - free_type free = nullptr; |
| - realloc_type realloc = nullptr; |
| - memalign_type memalign = nullptr; |
| - batch_malloc_type batch_malloc = nullptr; |
| - batch_free_type batch_free = nullptr; |
| - free_definite_size_type free_definite_size = nullptr; |
| - size_fn_type size = nullptr; |
| -}; |
| +// Saves the function pointers currently used by default zone. |
|
Mark Mentovai
2017/02/23 02:20:12
the default zone
erikchen
2017/02/23 20:06:44
Done.
|
| +void StoreFunctionsForDefaultZone(); |
| -// Saves the function pointers currently used by default zone into |functions|. |
| -void StoreFunctionsForDefaultZone(MallocZoneFunctions* functions); |
| +// Same as StoreFunctionsForDefaultZone, but for all malloc zones. |
| +void StoreFunctionsForAllZones(); |
| -// Updates the default malloc zone to use the functions specified by |
| +// For all malloc zones that have been stored, replace their functions with |
| // |functions|. |
| -void ReplaceFunctionsForDefaultZone(const MallocZoneFunctions* functions); |
| +void ReplaceFunctionsForStoredZones(const MallocZoneFunctions* functions); |
| extern bool g_replaced_default_zone; |