Tom Sepez | f07f001 | 2023-07-29 01:26:26 +0000 | [diff] [blame] | 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 | |
Lei Zhang | 9108588 | 2024-02-22 00:49:57 +0000 | [diff] [blame] | 7 | #include "core/fxcrt/check.h" |
Tom Sepez | 7b7a48c | 2023-10-06 21:32:35 +0000 | [diff] [blame] | 8 | #include "partition_alloc/dangling_raw_ptr_checks.h" |
Arthur Sonzogni | 3476811 | 2023-10-06 16:53:00 +0000 | [diff] [blame] | 9 | #include "partition_alloc/partition_alloc_buildflags.h" |
Bartek Nowierski | 471679d | 2023-12-21 05:05:19 +0000 | [diff] [blame] | 10 | #include "partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.h" |
Tom Sepez | f07f001 | 2023-07-29 01:26:26 +0000 | [diff] [blame] | 11 | |
| 12 | namespace pdfium { |
| 13 | |
| 14 | void ConfigurePartitionAllocShimPartitionForTest() { |
Arthur Sonzogni | 151ec02 | 2024-05-23 16:32:24 +0000 | [diff] [blame] | 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) |
Tom Sepez | 7b7a48c | 2023-10-06 21:32:35 +0000 | [diff] [blame] | 18 | partition_alloc::SetDanglingRawPtrDetectedFn([](uintptr_t) { CHECK(0); }); |
Arthur Sonzogni | 151ec02 | 2024-05-23 16:32:24 +0000 | [diff] [blame] | 19 | #endif // PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS) |
Bartek Nowierski | 471679d | 2023-12-21 05:05:19 +0000 | [diff] [blame] | 20 | allocator_shim::ConfigurePartitionsForTesting(); |
Arthur Sonzogni | 151ec02 | 2024-05-23 16:32:24 +0000 | [diff] [blame] | 21 | #endif // PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) |
| 22 | #endif // PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) |
Tom Sepez | f07f001 | 2023-07-29 01:26:26 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | } // namespace pdfium |