pdfium/testing/allocator_shim_config.cpp
Kalvin Lee 18443ade10 Use canonical PA buildflags
Bug: chromium:41481467
Change-Id: I352a30b51486656b64fbe0baa813bd75a7f968f8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/143750
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2026-02-25 09:18:56 -08:00

26 lines
933 B
C++

// Copyright 2023 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/allocator_shim_config.h"
#include "core/fxcrt/check.h"
#include "partition_alloc/buildflags.h"
#include "partition_alloc/dangling_raw_ptr_checks.h"
#include "partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.h"
namespace pdfium {
void ConfigurePartitionAllocShimPartitionForTest() {
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#if PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT)
#if PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
partition_alloc::SetDanglingRawPtrDetectedFn([](uintptr_t) { CHECK(0); });
#endif // PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
allocator_shim::ConfigurePartitionsForTesting();
#endif // PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT)
#endif // PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
}
} // namespace pdfium