| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ | 5 #ifndef BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
| 6 #define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ | 6 #define BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 11 #include "third_party/apple_apsl/malloc.h" | |
| 12 | 11 |
| 13 namespace base { | 12 namespace base { |
| 14 namespace allocator { | 13 namespace allocator { |
| 15 | 14 |
| 16 struct MallocZoneFunctions; | 15 struct MallocZoneFunctions; |
| 17 | 16 |
| 18 // Saves the function pointers currently used by the default zone. | 17 // Saves the function pointers currently used by the default zone. |
| 19 void StoreFunctionsForDefaultZone(); | 18 void StoreFunctionsForDefaultZone(); |
| 20 | 19 |
| 21 // Same as StoreFunctionsForDefaultZone, but for all malloc zones. | 20 // Same as StoreFunctionsForDefaultZone, but for all malloc zones. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 // Intercepts calls to default and purgeable malloc zones. Intercepts Core | 33 // Intercepts calls to default and purgeable malloc zones. Intercepts Core |
| 35 // Foundation and Objective-C allocations. | 34 // Foundation and Objective-C allocations. |
| 36 // Has no effect on the default malloc zone if the allocator shim already | 35 // Has no effect on the default malloc zone if the allocator shim already |
| 37 // performs that interception. | 36 // performs that interception. |
| 38 BASE_EXPORT void InterceptAllocationsMac(); | 37 BASE_EXPORT void InterceptAllocationsMac(); |
| 39 | 38 |
| 40 // Updates all malloc zones to use their original functions. | 39 // Updates all malloc zones to use their original functions. |
| 41 // Also calls ClearAllMallocZonesForTesting. | 40 // Also calls ClearAllMallocZonesForTesting. |
| 42 BASE_EXPORT void UninterceptMallocZonesForTesting(); | 41 BASE_EXPORT void UninterceptMallocZonesForTesting(); |
| 43 | 42 |
| 44 // Periodically checks for, and shims new malloc zones. Stops checking after 1 | |
| 45 // minute. | |
| 46 BASE_EXPORT void PeriodicallyShimNewMallocZones(); | |
| 47 | |
| 48 // Exposed for testing. | |
| 49 BASE_EXPORT void ShimNewMallocZones(); | |
| 50 BASE_EXPORT void ReplaceZoneFunctions(ChromeMallocZone* zone, | |
| 51 const MallocZoneFunctions* functions); | |
| 52 | |
| 53 } // namespace allocator | 43 } // namespace allocator |
| 54 } // namespace base | 44 } // namespace base |
| 55 | 45 |
| 56 #endif // BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ | 46 #endif // BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
| OLD | NEW |