1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef PARTITION_ALLOC_SHIM_EARLY_ZONE_REGISTRATION_CONSTANTS_H_ 6 #define PARTITION_ALLOC_SHIM_EARLY_ZONE_REGISTRATION_CONSTANTS_H_ 7 8 // This is an Apple-only file, used to register PartitionAlloc's zone *before* 9 // the process becomes multi-threaded. These constants are shared between the 10 // allocator shim which installs the PartitionAlloc's malloc zone and the 11 // application which installs the "early malloc zone" to reserve the zone slot. 12 13 namespace allocator_shim { 14 15 static constexpr char kDelegatingZoneName[] = 16 "DelegatingDefaultZoneForPartitionAlloc"; 17 static constexpr char kPartitionAllocZoneName[] = "PartitionAlloc"; 18 19 // Zone version. Determines which callbacks are set in the various malloc_zone_t 20 // structs. 21 #if (__MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) || \ 22 (__IPHONE_OS_VERSION_MAX_ALLOWED >= 160100) 23 #define PA_TRY_FREE_DEFAULT_IS_AVAILABLE 1 24 #endif 25 #if PA_TRY_FREE_DEFAULT_IS_AVAILABLE 26 constexpr int kZoneVersion = 13; 27 #else 28 constexpr int kZoneVersion = 9; 29 #endif 30 31 } // namespace allocator_shim 32 33 #endif // PARTITION_ALLOC_SHIM_EARLY_ZONE_REGISTRATION_CONSTANTS_H_ 34