Always use base::raw_ptr<> implementation when PartitionAlloc is present
Now that RawPtrNoOpImpl initializes by default (modulo build args),
we can use it whenever Partition Alloc is present. This is a first
step towards minimizing some code duplication between PDFium and PA.
Also activate a simple CHECK() on BRP dangling detection. We'd not
done this in the past as some of the elegant reporting mechanism
lives chrome-side. But we need this to make some unittests work
against the new #defined symbols. This is a test-only change.
Bug: pdfium:2038
Change-Id: I5b624f82343d75cc62e362e464f88a1c759468fa
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112350
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/allocator_shim_config.cpp b/testing/allocator_shim_config.cpp
index 416d82f..eb46fad 100644
--- a/testing/allocator_shim_config.cpp
+++ b/testing/allocator_shim_config.cpp
@@ -4,14 +4,19 @@
#include "testing/allocator_shim_config.h"
+#include "partition_alloc/dangling_raw_ptr_checks.h"
#include "partition_alloc/partition_alloc_buildflags.h"
#include "partition_alloc/shim/allocator_shim.h"
+#include "third_party/base/check.h"
namespace pdfium {
void ConfigurePartitionAllocShimPartitionForTest() {
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#if BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT)
+#if BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
+ partition_alloc::SetDanglingRawPtrDetectedFn([](uintptr_t) { CHECK(0); });
+#endif // BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
allocator_shim::ConfigurePartitions(
allocator_shim::EnableBrp(true),
allocator_shim::EnableMemoryTagging(false),