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" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 namespace allocator { | 14 namespace allocator { |
14 | 15 |
15 struct MallocZoneFunctions; | 16 struct MallocZoneFunctions; |
16 | 17 |
17 // Saves the function pointers currently used by the default zone. | 18 // Saves the function pointers currently used by the default zone. |
18 void StoreFunctionsForDefaultZone(); | 19 void StoreFunctionsForDefaultZone(); |
19 | 20 |
20 // Same as StoreFunctionsForDefaultZone, but for all malloc zones. | 21 // Same as StoreFunctionsForDefaultZone, but for all malloc zones. |
(...skipping 12 matching lines...) Expand all Loading... |
33 // Intercepts calls to default and purgeable malloc zones. Intercepts Core | 34 // Intercepts calls to default and purgeable malloc zones. Intercepts Core |
34 // Foundation and Objective-C allocations. | 35 // Foundation and Objective-C allocations. |
35 // Has no effect on the default malloc zone if the allocator shim already | 36 // Has no effect on the default malloc zone if the allocator shim already |
36 // performs that interception. | 37 // performs that interception. |
37 BASE_EXPORT void InterceptAllocationsMac(); | 38 BASE_EXPORT void InterceptAllocationsMac(); |
38 | 39 |
39 // Updates all malloc zones to use their original functions. | 40 // Updates all malloc zones to use their original functions. |
40 // Also calls ClearAllMallocZonesForTesting. | 41 // Also calls ClearAllMallocZonesForTesting. |
41 BASE_EXPORT void UninterceptMallocZonesForTesting(); | 42 BASE_EXPORT void UninterceptMallocZonesForTesting(); |
42 | 43 |
| 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 |
43 } // namespace allocator | 53 } // namespace allocator |
44 } // namespace base | 54 } // namespace base |
45 | 55 |
46 #endif // BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ | 56 #endif // BASE_ALLOCATOR_ALLOCATOR_INTERCEPTION_MAC_H_ |
OLD | NEW |