early_zone_registration_mac.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_ALLOCATOR_EARLY_ZONE_REGISTRATION_MAC_H_
  5. #define BASE_ALLOCATOR_EARLY_ZONE_REGISTRATION_MAC_H_
  6. // This is an Apple-only file, used to register PartitionAlloc's zone *before*
  7. // the process becomes multi-threaded.
  8. namespace partition_alloc {
  9. static constexpr char kDelegatingZoneName[] =
  10. "DelegatingDefaultZoneForPartitionAlloc";
  11. static constexpr char kPartitionAllocZoneName[] = "PartitionAlloc";
  12. // Zone version. Determines which callbacks are set in the various malloc_zone_t
  13. // structs.
  14. constexpr int kZoneVersion = 9;
  15. // Must be called *once*, *before* the process becomes multi-threaded.
  16. void EarlyMallocZoneRegistration();
  17. // Tricks the registration code to believe that PartitionAlloc was not already
  18. // registered. This allows a future library load to register PartitionAlloc's
  19. // zone as well, rather than bailing out.
  20. //
  21. // This is mutually exclusive with EarlyMallocZoneRegistation(), and should
  22. // ideally be removed. Indeed, by allowing two zones to be registered, we still
  23. // end up with a split heap, and more memory usage.
  24. //
  25. // This is a hack for crbug.com/1274236.
  26. void AllowDoublePartitionAllocZoneRegistration();
  27. } // namespace partition_alloc
  28. #endif // BASE_ALLOCATOR_EARLY_ZONE_REGISTRATION_H_