1 // Copyright 2023 The PDFium 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 #include "testing/allocator_shim_config.h" 6 7 #include "core/fxcrt/check.h" 8 #include "partition_alloc/dangling_raw_ptr_checks.h" 9 #include "partition_alloc/partition_alloc_buildflags.h" 10 #include "partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.h" 11 12 namespace pdfium { 13 ConfigurePartitionAllocShimPartitionForTest()14void ConfigurePartitionAllocShimPartitionForTest() { 15 #if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) 16 #if PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) 17 #if PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS) 18 partition_alloc::SetDanglingRawPtrDetectedFn([](uintptr_t) { CHECK(0); }); 19 #endif // PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS) 20 allocator_shim::ConfigurePartitionsForTesting(); 21 #endif // PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) 22 #endif // PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) 23 } 24 25 } // namespace pdfium 26