From e4b035b722ad69d4a4357c54cd3c9f1f8574b067 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sun, 26 Mar 2017 15:48:34 -0700 Subject: Use PartitionAlloc for JavaScript ArrayBuffers and strings. BUG=pdfium:681 Change-Id: I5073d80d9bd623b73e578d5ba2226c39c371bab0 Reviewed-on: https://pdfium-review.googlesource.com/3097 Commit-Queue: Chris Palmer Reviewed-by: Tom Sepez --- fpdfsdk/fpdfview.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 4c3631fc88..d4284a3217 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -33,6 +33,7 @@ #include "fpdfsdk/javascript/ijs_runtime.h" #include "public/fpdf_ext.h" #include "public/fpdf_progressive.h" +#include "third_party/base/allocator/partition_allocator/partition_alloc.h" #include "third_party/base/numerics/safe_conversions_impl.h" #include "third_party/base/ptr_util.h" @@ -367,6 +368,14 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { if (g_pCodecModule) return; + static bool s_gPartitionAllocatorsInitialized = false; + if (!s_gPartitionAllocatorsInitialized) { + pdfium::base::PartitionAllocGlobalInit(FX_OutOfMemoryTerminate); + gArrayBufferPartitionAllocator.init(); + gStringPartitionAllocator.init(); + s_gPartitionAllocatorsInitialized = true; + } + g_pCodecModule = new CCodec_ModuleMgr(); CFX_GEModule* pModule = CFX_GEModule::Get(); -- cgit v1.2.3