Index: base/allocator/allocator_interception_mac.h |
diff --git a/base/allocator/allocator_interception_mac.h b/base/allocator/allocator_interception_mac.h |
index 87cbf4896e941178837efa0843f881369c36975b..694d66b34be23f32c8ea7217d4b9a75289441222 100644 |
--- a/base/allocator/allocator_interception_mac.h |
+++ b/base/allocator/allocator_interception_mac.h |
@@ -25,22 +25,38 @@ typedef void* (*realloc_type)(struct _malloc_zone_t* zone, |
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 { |
+ 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 |zone| into |functions|. |
-void StoreZoneFunctions(ChromeMallocZone* zone, MallocZoneFunctions* functions); |
+// Saves the function pointers currently used by default zone into |functions|. |
+void StoreFunctionsForDefaultZone(MallocZoneFunctions* functions); |
-// Updates the malloc zone to use the functions specified by |functions|. |
-void ReplaceZoneFunctions(ChromeMallocZone* zone, |
- const MallocZoneFunctions* functions); |
+// Updates the default malloc zone to use the functions specified by |
+// |functions|. |
+void ReplaceFunctionsForDefaultZone(const MallocZoneFunctions* functions); |
// Calls the original implementation of malloc/calloc prior to interception. |
bool UncheckedMallocMac(size_t size, void** result); |
@@ -48,6 +64,8 @@ bool UncheckedCallocMac(size_t num_items, size_t size, void** result); |
// Intercepts calls to default and purgeable malloc zones. Intercepts Core |
// Foundation and Objective-C allocations. |
+// Has no effect on the default malloc zone if the allocator shim already |
+// performs that interception. |
void InterceptAllocationsMac(); |
} // namespace allocator |
} // namespace base |