| Index: base/allocator/allocator_shim.cc
|
| diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
|
| index a401139ee652d5043279aa899674aba7b82101b1..e6eb256cf568925ab441cc75c4539ba6d005bc32 100644
|
| --- a/base/allocator/allocator_shim.cc
|
| +++ b/base/allocator/allocator_shim.cc
|
| @@ -25,6 +25,8 @@
|
| #include <malloc/malloc.h>
|
|
|
| #include "base/allocator/allocator_interception_mac.h"
|
| +#include "base/base_switches.h"
|
| +#include "base/command_line.h"
|
| #endif
|
|
|
| // No calls to malloc / new in this file. They would would cause re-entrancy of
|
| @@ -328,6 +330,13 @@ void InitializeAllocatorShim() {
|
|
|
| MallocZoneFunctions functions = MallocZoneFunctionsToReplaceDefault();
|
|
|
| + // Intercept and override newly registered malloc zones.
|
| + if (CommandLine::InitializedForCurrentProcess() &&
|
| + CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableHeapProfiling)) {
|
| + InterceptNewlyRegisteredMallocZones(&functions);
|
| + }
|
| +
|
| // This replaces the default malloc zone, causing calls to malloc & friends
|
| // from the codebase to be routed to ShimMalloc() above.
|
| base::allocator::ReplaceFunctionsForStoredZones(&functions);
|
|
|