Define preprocessor macro PDF_USE_PARTITION_ALLOC
We will need to know this in order to support an implementation of
UnownedPtr<T> based upon base::raw_ptr<T>.
-- assert that the symbol is correctly defined in conditionally
compiled files.
Change-Id: Ic70af737634087da60abbae80e47bbc4d80e4211
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103497
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index a853212..0cd3fa9 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -40,6 +40,10 @@
defines += [ "_SKIA_SUPPORT_" ]
}
+ if (pdf_use_partition_alloc) {
+ defines += [ "PDF_USE_PARTITION_ALLOC" ]
+ }
+
if (is_win) {
# Assume UTF-8 by default to avoid code page dependencies.
cflags += [ "/utf-8" ]
diff --git a/core/fxcrt/fx_memory_malloc.cpp b/core/fxcrt/fx_memory_malloc.cpp
index 00144a0..44a05c6 100644
--- a/core/fxcrt/fx_memory_malloc.cpp
+++ b/core/fxcrt/fx_memory_malloc.cpp
@@ -13,6 +13,10 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_safe_types.h"
+#if defined(PDF_USE_PARTITION_ALLOC)
+#error "File compiled under wrong build option."
+#endif
+
namespace pdfium {
namespace internal {
diff --git a/core/fxcrt/fx_memory_pa.cpp b/core/fxcrt/fx_memory_pa.cpp
index f68bc78..35c043a 100644
--- a/core/fxcrt/fx_memory_pa.cpp
+++ b/core/fxcrt/fx_memory_pa.cpp
@@ -10,6 +10,10 @@
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/no_destructor.h"
+#if !defined(PDF_USE_PARTITION_ALLOC)
+#error "File compiled under wrong build option."
+#endif
+
namespace {
constexpr partition_alloc::PartitionOptions kOptions = {