summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/cfx_string_data_template.h5
-rw-r--r--core/fxcrt/fx_basic_memmgr.cpp3
-rw-r--r--core/fxcrt/fx_memory.h5
3 files changed, 11 insertions, 2 deletions
diff --git a/core/fxcrt/cfx_string_data_template.h b/core/fxcrt/cfx_string_data_template.h
index 2e87a811a5..33013fde33 100644
--- a/core/fxcrt/cfx_string_data_template.h
+++ b/core/fxcrt/cfx_string_data_template.h
@@ -35,7 +35,8 @@ class CFX_StringDataTemplate {
int usableLen = (totalSize - overhead) / sizeof(CharType);
ASSERT(usableLen >= nLen);
- void* pData = FX_Alloc(uint8_t, totalSize);
+ void* pData = pdfium::base::PartitionAllocGeneric(
+ gStringPartitionAllocator.root(), totalSize, "CFX_StringDataTemplate");
return new (pData) CFX_StringDataTemplate(nLen, usableLen);
}
@@ -54,7 +55,7 @@ class CFX_StringDataTemplate {
void Retain() { ++m_nRefs; }
void Release() {
if (--m_nRefs <= 0)
- FX_Free(this);
+ pdfium::base::PartitionFree(this);
}
bool CanOperateInPlace(FX_STRSIZE nTotalLen) const {
diff --git a/core/fxcrt/fx_basic_memmgr.cpp b/core/fxcrt/fx_basic_memmgr.cpp
index 927b994b5f..06568c04ad 100644
--- a/core/fxcrt/fx_basic_memmgr.cpp
+++ b/core/fxcrt/fx_basic_memmgr.cpp
@@ -8,6 +8,9 @@
#include "core/fxcrt/fx_memory.h"
+pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator;
+pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator;
+
void* FXMEM_DefaultAlloc(size_t byte_size, int flags) {
return (void*)malloc(byte_size);
}
diff --git a/core/fxcrt/fx_memory.h b/core/fxcrt/fx_memory.h
index 0ad28ce896..c4d619efab 100644
--- a/core/fxcrt/fx_memory.h
+++ b/core/fxcrt/fx_memory.h
@@ -26,6 +26,11 @@ void FXMEM_DefaultFree(void* pointer, int flags);
#include <memory>
#include <new>
+#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
+
+extern pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator;
+extern pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator;
+
NEVER_INLINE void FX_OutOfMemoryTerminate();
inline void* FX_SafeRealloc(void* ptr, size_t num_members, size_t member_size) {