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..3c99dfe946731886b0b970fee41f895fb3f56e2b 100644 |
--- a/base/allocator/allocator_interception_mac.h |
+++ b/base/allocator/allocator_interception_mac.h |
@@ -5,59 +5,23 @@ |
#ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
#define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
-#include <malloc/malloc.h> |
#include <stddef.h> |
+#include "base/allocator/malloc_zone_aggregator_mac.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); |
+// Saves the function pointers currently used by default zone into |aggregator|. |
+void StoreFunctionsForDefaultZone(MallocZoneAggregator* aggregator); |
-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; |
-}; |
+// Same as StoreFunctionsForDefaultZone, but for all malloc zones. |
+void StoreFunctionsForAllZones(MallocZoneAggregator* aggregator); |
-// Saves the function pointers currently used by default zone into |functions|. |
-void StoreFunctionsForDefaultZone(MallocZoneFunctions* functions); |
- |
-// 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; |