blob: 3d8fde1db3af14ba8098ee6005ea5696c56f5400 [file] [log] [blame]
Tom Sepezf07f0012023-07-29 01:26:26 +00001// 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 Zhang91085882024-02-22 00:49:57 +00007#include "core/fxcrt/check.h"
Tom Sepez7b7a48c2023-10-06 21:32:35 +00008#include "partition_alloc/dangling_raw_ptr_checks.h"
Arthur Sonzogni34768112023-10-06 16:53:00 +00009#include "partition_alloc/partition_alloc_buildflags.h"
Bartek Nowierski471679d2023-12-21 05:05:19 +000010#include "partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.h"
Tom Sepezf07f0012023-07-29 01:26:26 +000011
12namespace pdfium {
13
14void ConfigurePartitionAllocShimPartitionForTest() {
Arthur Sonzogni151ec022024-05-23 16:32:24 +000015#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 Sepez7b7a48c2023-10-06 21:32:35 +000018 partition_alloc::SetDanglingRawPtrDetectedFn([](uintptr_t) { CHECK(0); });
Arthur Sonzogni151ec022024-05-23 16:32:24 +000019#endif // PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
Bartek Nowierski471679d2023-12-21 05:05:19 +000020 allocator_shim::ConfigurePartitionsForTesting();
Arthur Sonzogni151ec022024-05-23 16:32:24 +000021#endif // PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT)
22#endif // PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
Tom Sepezf07f0012023-07-29 01:26:26 +000023}
24
25} // namespace pdfium