| Index: base/allocator/allocator_interception_mac.h
|
| diff --git a/base/allocator/allocator_interception_mac.h b/base/allocator/allocator_interception_mac.h
|
| index 6be5210947e1f6c8e51b9654040fe03d48c0a2a7..87cbf4896e941178837efa0843f881369c36975b 100644
|
| --- a/base/allocator/allocator_interception_mac.h
|
| +++ b/base/allocator/allocator_interception_mac.h
|
| @@ -5,11 +5,43 @@
|
| #ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_
|
| #define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_
|
|
|
| +#include <malloc/malloc.h>
|
| #include <stddef.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);
|
| +
|
| +struct 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;
|
| +};
|
| +
|
| +// Saves the function pointers currently used by |zone| into |functions|.
|
| +void StoreZoneFunctions(ChromeMallocZone* zone, MallocZoneFunctions* functions);
|
| +
|
| +// Updates the malloc zone to use the functions specified by |functions|.
|
| +void ReplaceZoneFunctions(ChromeMallocZone* zone,
|
| + const MallocZoneFunctions* functions);
|
| +
|
| // Calls the original implementation of malloc/calloc prior to interception.
|
| bool UncheckedMallocMac(size_t size, void** result);
|
| bool UncheckedCallocMac(size_t num_items, size_t size, void** result);
|
|
|