summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/css/fde_cssdatatable.cpp2
-rw-r--r--xfa/fde/css/fde_cssdatatable.h2
-rw-r--r--xfa/fde/css/fde_cssdeclaration.cpp47
-rw-r--r--xfa/fde/css/fde_cssdeclaration.h14
-rw-r--r--xfa/fde/css/fde_cssstyleselector.cpp17
-rw-r--r--xfa/fde/css/fde_cssstyleselector.h12
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp14
-rw-r--r--xfa/fde/css/fde_cssstylesheet.h8
-rw-r--r--xfa/fee/fde_txtedtbuf.cpp5
-rw-r--r--xfa/fee/fde_txtedtbuf.h2
-rw-r--r--xfa/fgas/crt/fgas_memory.cpp284
-rw-r--r--xfa/fgas/crt/fgas_memory.h22
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp10
-rw-r--r--xfa/fxfa/app/xfa_textlayout.h15
14 files changed, 126 insertions, 328 deletions
diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp
index 853666f4ed..3b090a2699 100644
--- a/xfa/fde/css/fde_cssdatatable.cpp
+++ b/xfa/fde/css/fde_cssdatatable.cpp
@@ -779,7 +779,7 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue,
return FALSE;
}
-CFDE_CSSValueList::CFDE_CSSValueList(IFX_MEMAllocator* pStaticStore,
+CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSValueArray& list) {
m_iCount = list.GetSize();
int32_t iByteCount = m_iCount * sizeof(IFDE_CSSValue*);
diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h
index dda04c4691..30e7eb0ee6 100644
--- a/xfa/fde/css/fde_cssdatatable.h
+++ b/xfa/fde/css/fde_cssdatatable.h
@@ -91,7 +91,7 @@ typedef CFX_ArrayTemplate<IFDE_CSSPrimitiveValue*> CFDE_CSSPrimitiveArray;
typedef CFX_ArrayTemplate<IFDE_CSSValue*> CFDE_CSSValueArray;
class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target {
public:
- CFDE_CSSValueList(IFX_MEMAllocator* pStaticStore,
+ CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSValueArray& list);
virtual int32_t CountValues() const { return m_iCount; }
virtual IFDE_CSSValue* GetValue(int32_t index) const {
diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp
index 80945245cf..f4f55fc0db 100644
--- a/xfa/fde/css/fde_cssdeclaration.cpp
+++ b/xfa/fde/css/fde_cssdeclaration.cpp
@@ -76,7 +76,7 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal(
return psz;
}
IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue(
- IFX_MEMAllocator* pStaticStore,
+ IFX_MemoryAllocator* pStaticStore,
FDE_CSSPRIMITIVETYPE eUnit,
FX_FLOAT fValue) const {
static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f);
@@ -86,11 +86,11 @@ IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue(
return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue);
}
inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue(
- IFX_MEMAllocator* pStaticStore,
+ IFX_MemoryAllocator* pStaticStore,
FDE_CSSPROPERTYVALUE eValue) const {
return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue);
}
-void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MEMAllocator* pStaticStore,
+void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore,
FDE_CSSPROPERTY eProperty,
IFDE_CSSValue* pValue,
FX_BOOL bImportant) {
@@ -168,7 +168,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs,
}
} break;
case FDE_CSSVALUETYPE_Shorthand: {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
IFDE_CSSValue *pColor, *pStyle, *pWidth;
switch (pArgs->pProperty->eName) {
case FDE_CSSPROPERTY_Font:
@@ -415,7 +415,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = (IFX_MEMAllocator*)pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
FDE_CSSPRIMITIVETYPE eType;
CFDE_CSSValueArray list;
@@ -479,7 +479,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
CFDE_CSSValueArray list;
CFDE_CSSValueArray listFull;
@@ -535,7 +535,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
FX_WCHAR separator =
(pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' ';
CFDE_CSSValueListParser parser(pszValue, iValueLen, separator);
@@ -628,13 +628,14 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty(
}
return FALSE;
}
-FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MEMAllocator* pStaticStore,
- const CFDE_CSSValueArray& list,
- FX_BOOL bImportant,
- FDE_CSSPROPERTY eLeft,
- FDE_CSSPROPERTY eTop,
- FDE_CSSPROPERTY eRight,
- FDE_CSSPROPERTY eBottom) {
+FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty(
+ IFX_MemoryAllocator* pStaticStore,
+ const CFDE_CSSValueArray& list,
+ FX_BOOL bImportant,
+ FDE_CSSPROPERTY eLeft,
+ FDE_CSSPROPERTY eTop,
+ FDE_CSSPROPERTY eRight,
+ FDE_CSSPROPERTY eBottom) {
switch (list.GetSize()) {
case 1:
AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant);
@@ -666,7 +667,7 @@ FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MEMAllocator* pStaticStore,
return FALSE;
}
FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
- IFX_MEMAllocator* pStaticStore,
+ IFX_MemoryAllocator* pStaticStore,
const FX_WCHAR* pszValue,
int32_t iValueLen,
IFDE_CSSValue*& pColor,
@@ -756,7 +757,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty(
}
return TRUE;
}
-void CFDE_CSSDeclaration::AddBorderProperty(IFX_MEMAllocator* pStaticStore,
+void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore,
IFDE_CSSValue* pColor,
IFDE_CSSValue* pStyle,
IFDE_CSSValue* pWidth,
@@ -773,7 +774,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
IFDE_CSSPrimitiveValue *pType = NULL, *pImage = NULL, *pPosition = NULL;
FDE_CSSPRIMITIVETYPE eType;
@@ -853,7 +854,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
IFDE_CSSPrimitiveValue *pColor = NULL, *pImage = NULL, *pRepeat = NULL;
IFDE_CSSPrimitiveValue *pPosX = NULL, *pPosY = NULL, *pAttachment = NULL;
@@ -992,7 +993,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs,
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, '/');
IFDE_CSSPrimitiveValue *pStyle = NULL, *pVariant = NULL, *pWeight = NULL;
IFDE_CSSPrimitiveValue *pFontSize = NULL, *pLineHeight = NULL;
@@ -1130,7 +1131,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
IFDE_CSSPrimitiveValue* pColumnRuleWidth = NULL;
IFDE_CSSPrimitiveValue* pColumnRuleStyle = NULL;
@@ -1228,7 +1229,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
CFDE_CSSValueArray arrEmphasisStyle;
FDE_CSSPRIMITIVETYPE eType;
@@ -1281,7 +1282,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
IFDE_CSSPrimitiveValue* pColumnWidth = NULL;
IFDE_CSSPrimitiveValue* pColumnCount = NULL;
@@ -1334,7 +1335,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty(
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant) {
- IFX_MEMAllocator* pStaticStore = pArgs->pStaticStore;
+ IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore;
CFDE_CSSValueListParser parser(pszValue, iValueLen, ' ');
IFDE_CSSPrimitiveValue* pOverflowX = NULL;
IFDE_CSSPrimitiveValue* pOverflowY = NULL;
diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h
index d9bacd0e4f..4fa6858f97 100644
--- a/xfa/fde/css/fde_cssdeclaration.h
+++ b/xfa/fde/css/fde_cssdeclaration.h
@@ -25,7 +25,7 @@ class FDE_CSSCustomProperty : public CFX_Target {
};
struct FDE_CSSPROPERTYARGS {
- IFX_MEMAllocator* pStaticStore;
+ IFX_MemoryAllocator* pStaticStore;
CFX_MapPtrToPtr* pStringCache;
FDE_LPCCSSPROPERTYTABLE pProperty;
};
@@ -87,13 +87,13 @@ class CFDE_CSSDeclaration : public CFX_Target {
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant);
- FX_BOOL ParseBorderPropoerty(IFX_MEMAllocator* pStaticStore,
+ FX_BOOL ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore,
const FX_WCHAR* pszValue,
int32_t iValueLen,
IFDE_CSSValue*& pColor,
IFDE_CSSValue*& pStyle,
IFDE_CSSValue*& pWidth) const;
- void AddBorderProperty(IFX_MEMAllocator* pStaticStore,
+ void AddBorderProperty(IFX_MemoryAllocator* pStaticStore,
IFDE_CSSValue* pColor,
IFDE_CSSValue* pStyle,
IFDE_CSSValue* pWidth,
@@ -113,7 +113,7 @@ class CFDE_CSSDeclaration : public CFX_Target {
const FX_WCHAR* pszValue,
int32_t iValueLen,
FX_BOOL bImportant);
- FX_BOOL Add4ValuesProperty(IFX_MEMAllocator* pStaticStore,
+ FX_BOOL Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSValueArray& list,
FX_BOOL bImportant,
FDE_CSSPROPERTY eLeft,
@@ -141,14 +141,14 @@ class CFDE_CSSDeclaration : public CFX_Target {
const FX_WCHAR* CopyToLocal(const FDE_CSSPROPERTYARGS* pArgs,
const FX_WCHAR* pszValue,
int32_t iValueLen);
- void AddPropertyHolder(IFX_MEMAllocator* pStaticStore,
+ void AddPropertyHolder(IFX_MemoryAllocator* pStaticStore,
FDE_CSSPROPERTY eProperty,
IFDE_CSSValue* pValue,
FX_BOOL bImportant);
- IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MEMAllocator* pStaticStore,
+ IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MemoryAllocator* pStaticStore,
FDE_CSSPRIMITIVETYPE eUnit,
FX_FLOAT fValue) const;
- IFDE_CSSPrimitiveValue* NewEnumValue(IFX_MEMAllocator* pStaticStore,
+ IFDE_CSSPrimitiveValue* NewEnumValue(IFX_MemoryAllocator* pStaticStore,
FDE_CSSPROPERTYVALUE eValue) const;
FDE_CSSPropertyHolder* m_pFirstProperty;
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp
index 55a1477b4c..01a19267e1 100644
--- a/xfa/fde/css/fde_cssstyleselector.cpp
+++ b/xfa/fde/css/fde_cssstyleselector.cpp
@@ -247,10 +247,9 @@ CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() {
IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle(
IFDE_CSSComputedStyle* pParentStyle) {
- if (m_pFixedStyleStore == NULL) {
- m_pFixedStyleStore = FX_CreateAllocator(FX_ALLOCTYPE_Fixed, 16,
- sizeof(CFDE_CSSComputedStyle));
- ASSERT(m_pFixedStyleStore != NULL);
+ if (!m_pFixedStyleStore) {
+ m_pFixedStyleStore = IFX_MemoryAllocator::Create(
+ FX_ALLOCTYPE_Fixed, 16, sizeof(CFDE_CSSComputedStyle));
}
CFDE_CSSComputedStyle* pStyle = FXTARGET_NewWith(m_pFixedStyleStore)
CFDE_CSSComputedStyle(m_pFixedStyleStore);
@@ -292,8 +291,7 @@ void CFDE_CSSStyleSelector::SetStylePriority(
}
void CFDE_CSSStyleSelector::UpdateStyleIndex(uint32_t dwMediaList) {
Reset();
- m_pRuleDataStore = FX_CreateAllocator(FX_ALLOCTYPE_Static, 1024, 0);
- ASSERT(m_pRuleDataStore != NULL);
+ m_pRuleDataStore = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0);
for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) {
CFDE_CSSRuleCollection& rules = m_RuleCollection[iGroup];
rules.m_pStaticStore = m_pRuleDataStore;
@@ -425,9 +423,10 @@ void CFDE_CSSStyleSelector::ComputeStyle(
static const uint32_t s_dwAlignHash = FX_HashCode_GetW(L"align", true);
if (!pTag->empty()) {
- if (!m_pInlineStyleStore)
- m_pInlineStyleStore = FX_CreateAllocator(FX_ALLOCTYPE_Static, 2048, 0);
-
+ if (!m_pInlineStyleStore) {
+ m_pInlineStyleStore =
+ IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 2048, 0);
+ }
CFDE_CSSDeclaration* pDecl = nullptr;
for (auto it : *pTag) {
CFX_WideString wsAttri = it.first;
diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h
index 6c23a9eb1d..790149c596 100644
--- a/xfa/fde/css/fde_cssstyleselector.h
+++ b/xfa/fde/css/fde_cssstyleselector.h
@@ -68,7 +68,7 @@ class CFDE_CSSRuleCollection : public CFX_Target {
FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; }
FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; }
- IFX_MEMAllocator* m_pStaticStore;
+ IFX_MemoryAllocator* m_pStaticStore;
protected:
void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet,
@@ -182,12 +182,12 @@ class CFDE_CSSStyleSelector : public CFX_Target {
IFX_FontMgr* m_pFontMgr;
FX_FLOAT m_fDefFontSize;
- IFX_MEMAllocator* m_pRuleDataStore;
+ IFX_MemoryAllocator* m_pRuleDataStore;
CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX];
CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX];
FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX];
- IFX_MEMAllocator* m_pInlineStyleStore;
- IFX_MEMAllocator* m_pFixedStyleStore;
+ IFX_MemoryAllocator* m_pInlineStyleStore;
+ IFX_MemoryAllocator* m_pFixedStyleStore;
CFDE_CSSAccelerator* m_pAccelerator;
std::vector<FDE_CSSRuleData*> m_MatchedRules;
};
@@ -387,7 +387,7 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle,
public IFDE_CSSParagraphStyle,
public CFX_Target {
public:
- CFDE_CSSComputedStyle(IFX_MEMAllocator* pAlloc)
+ CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc)
: m_dwRefCount(1), m_pAllocator(pAlloc) {}
~CFDE_CSSComputedStyle() {}
@@ -580,7 +580,7 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle,
}
uint32_t m_dwRefCount;
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
CFDE_CSSInheritedData m_InheritedData;
CFDE_CSSNonInheritedData m_NonInheritedData;
CFX_WideStringArray m_CustomProperties;
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp
index 7a661af1c0..db01274d6a 100644
--- a/xfa/fde/css/fde_cssstylesheet.cpp
+++ b/xfa/fde/css/fde_cssstylesheet.cpp
@@ -150,10 +150,7 @@ FX_BOOL CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl,
}
FX_BOOL CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) {
Reset();
- m_pAllocator = FX_CreateAllocator(FX_ALLOCTYPE_Static, 1024, 0);
- if (m_pAllocator == NULL) {
- return FALSE;
- }
+ m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0);
FDE_CSSSYNTAXSTATUS eStatus;
do {
switch (eStatus = pSyntax->DoSyntaxParse()) {
@@ -357,7 +354,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::SkipRuleSet(
}
return FDE_CSSSYNTAXSTATUS_None;
}
-void CFDE_CSSStyleRule::SetSelector(IFX_MEMAllocator* pStaticStore,
+void CFDE_CSSStyleRule::SetSelector(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSSelectorArray& list) {
ASSERT(m_ppSelector == NULL);
m_iSelectors = list.GetSize();
@@ -409,9 +406,10 @@ int32_t FDE_GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) {
}
return psz - pStart;
}
-CFDE_CSSSelector* CFDE_CSSSelector::FromString(IFX_MEMAllocator* pStaticStore,
- const FX_WCHAR* psz,
- int32_t iLen) {
+CFDE_CSSSelector* CFDE_CSSSelector::FromString(
+ IFX_MemoryAllocator* pStaticStore,
+ const FX_WCHAR* psz,
+ int32_t iLen) {
ASSERT(pStaticStore != NULL && psz != NULL && iLen > 0);
const FX_WCHAR* pStart = psz;
const FX_WCHAR* pEnd = psz + iLen;
diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h
index 2a337d0a24..a78ae487bb 100644
--- a/xfa/fde/css/fde_cssstylesheet.h
+++ b/xfa/fde/css/fde_cssstylesheet.h
@@ -26,13 +26,13 @@ class CFDE_CSSSelector : public CFX_Target {
virtual uint32_t GetNameHash() const { return m_dwHash; }
virtual CFDE_CSSSelector* GetNextSelector() const { return m_pNext; }
- static CFDE_CSSSelector* FromString(IFX_MEMAllocator* pStaticStore,
+ static CFDE_CSSSelector* FromString(IFX_MemoryAllocator* pStaticStore,
const FX_WCHAR* psz,
int32_t iLen);
void SetNext(CFDE_CSSSelector* pNext) { m_pNext = pNext; }
protected:
- static CFDE_CSSSelector* ParseSelector(IFX_MEMAllocator* pStaticStore,
+ static CFDE_CSSSelector* ParseSelector(IFX_MemoryAllocator* pStaticStore,
const FX_WCHAR* psz,
int32_t& iOff,
int32_t iLen,
@@ -54,7 +54,7 @@ class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target {
CFDE_CSSDeclaration* GetDeclaration() override { return &m_Declaration; }
CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; }
- void SetSelector(IFX_MEMAllocator* pStaticStore,
+ void SetSelector(IFX_MemoryAllocator* pStaticStore,
const CFDE_CSSSelectorArray& list);
protected:
@@ -130,7 +130,7 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target {
uint16_t m_wCodePage;
uint16_t m_wRefCount;
uint32_t m_dwMediaList;
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
CFDE_CSSRuleArray m_RuleArray;
CFX_WideString m_szUrl;
CFDE_CSSSelectorArray m_Selectors;
diff --git a/xfa/fee/fde_txtedtbuf.cpp b/xfa/fee/fde_txtedtbuf.cpp
index 988ca4a5c1..1369d55be5 100644
--- a/xfa/fee/fde_txtedtbuf.cpp
+++ b/xfa/fee/fde_txtedtbuf.cpp
@@ -370,9 +370,8 @@ void CFDE_TxtEdtBuf::ResetChunkBuffer(int32_t nDefChunkCount,
m_nChunkSize = nChunkSize;
int32_t nChunkLength =
sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR);
- m_pAllocator =
- FX_CreateAllocator(FX_ALLOCTYPE_Fixed, nDefChunkCount, nChunkLength);
- ASSERT(m_pAllocator);
+ m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, nDefChunkCount,
+ nChunkLength);
FDE_CHUNKHEADER* lpChunkHeader =
static_cast<FDE_CHUNKHEADER*>(m_pAllocator->Alloc(nChunkLength));
ASSERT(lpChunkHeader);
diff --git a/xfa/fee/fde_txtedtbuf.h b/xfa/fee/fde_txtedtbuf.h
index 5d7de45401..673d2b98ca 100644
--- a/xfa/fee/fde_txtedtbuf.h
+++ b/xfa/fee/fde_txtedtbuf.h
@@ -81,7 +81,7 @@ class CFDE_TxtEdtBuf {
int32_t m_nTotal;
FX_BOOL m_bChanged;
CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks;
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
};
#endif // XFA_FEE_FDE_TXTEDTBUF_H_
diff --git a/xfa/fgas/crt/fgas_memory.cpp b/xfa/fgas/crt/fgas_memory.cpp
index 4334789cb7..04c4b31dd0 100644
--- a/xfa/fgas/crt/fgas_memory.cpp
+++ b/xfa/fgas/crt/fgas_memory.cpp
@@ -6,46 +6,48 @@
#include "xfa/fgas/crt/fgas_memory.h"
+#define MEMORY_TOOL_REPLACES_ALLOCATOR // Temporary, for CF testing.
+
#include <algorithm>
+#ifdef MEMORY_TOOL_REPLACES_ALLOCATOR
+
namespace {
-class CFX_DefStore : public IFX_MEMAllocator, public CFX_Target {
+class CFX_DefStore : public IFX_MemoryAllocator, public CFX_Target {
public:
CFX_DefStore() {}
~CFX_DefStore() {}
virtual void Release() { delete this; }
virtual void* Alloc(size_t size) { return FX_Alloc(uint8_t, size); }
virtual void Free(void* pBlock) { FX_Free(pBlock); }
- virtual size_t GetBlockSize() const { return 0; }
- virtual size_t GetDefChunkSize() const { return 0; }
- virtual size_t SetDefChunkSize(size_t size) { return 0; }
- virtual size_t GetCurrentDataSize() const { return 0; }
};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(push, 1)
-#endif
+} // namespace
+
+IFX_MemoryAllocator* IFX_MemoryAllocator::Create(FX_ALLOCTYPE eType,
+ size_t chunkSize,
+ size_t blockSize) {
+ return new CFX_DefStore();
+}
+
+#else // MEMORY_TOOL_REPLACES_ALLOCATOR
+
+namespace {
+
struct FX_STATICSTORECHUNK {
FX_STATICSTORECHUNK* pNextChunk;
size_t iChunkSize;
size_t iFreeSize;
};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(pop)
-#endif
-class CFX_StaticStore : public IFX_MEMAllocator, public CFX_Target {
+class CFX_StaticStore : public IFX_MemoryAllocator, public CFX_Target {
public:
CFX_StaticStore(size_t iDefChunkSize = 4096);
~CFX_StaticStore();
virtual void Release() { delete this; }
virtual void* Alloc(size_t size);
virtual void Free(void* pBlock) {}
- virtual size_t GetBlockSize() const { return 0; }
- virtual size_t GetDefChunkSize() const { return m_iDefChunkSize; }
- virtual size_t SetDefChunkSize(size_t size);
- virtual size_t GetCurrentDataSize() const { return m_iAllocatedSize; }
protected:
size_t m_iAllocatedSize;
@@ -56,9 +58,6 @@ class CFX_StaticStore : public IFX_MEMAllocator, public CFX_Target {
FX_STATICSTORECHUNK* FindChunk(size_t size);
};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(push, 1)
-#endif
struct FX_FIXEDSTORECHUNK {
uint8_t* FirstFlag() { return reinterpret_cast<uint8_t*>(this + 1); }
uint8_t* FirstBlock() { return FirstFlag() + iChunkSize; }
@@ -67,21 +66,14 @@ struct FX_FIXEDSTORECHUNK {
size_t iChunkSize;
size_t iFreeNum;
};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(pop)
-#endif
-class CFX_FixedStore : public IFX_MEMAllocator, public CFX_Target {
+class CFX_FixedStore : public IFX_MemoryAllocator, public CFX_Target {
public:
CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk);
virtual ~CFX_FixedStore();
virtual void Release() { delete this; }
virtual void* Alloc(size_t size);
virtual void Free(void* pBlock);
- virtual size_t GetBlockSize() const { return m_iBlockSize; }
- virtual size_t GetDefChunkSize() const { return m_iDefChunkSize; }
- virtual size_t SetDefChunkSize(size_t iChunkSize);
- virtual size_t GetCurrentDataSize() const { return 0; }
protected:
FX_FIXEDSTORECHUNK* AllocChunk();
@@ -91,74 +83,29 @@ class CFX_FixedStore : public IFX_MEMAllocator, public CFX_Target {
FX_FIXEDSTORECHUNK* m_pChunk;
};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(push, 1)
-#endif
-struct FX_DYNAMICSTOREBLOCK {
- uint8_t* Data() { return reinterpret_cast<uint8_t*>(this + 1); }
- FX_DYNAMICSTOREBLOCK* NextBlock() {
- return reinterpret_cast<FX_DYNAMICSTOREBLOCK*>(Data() + iBlockSize);
- }
- size_t iBlockSize;
- FX_BOOL bUsed;
-};
-
-struct FX_DYNAMICSTORECHUNK {
- FX_DYNAMICSTOREBLOCK* FirstBlock() {
- return reinterpret_cast<FX_DYNAMICSTOREBLOCK*>(this + 1);
- }
- FX_DYNAMICSTORECHUNK* pNextChunk;
- size_t iChunkSize;
- size_t iFreeSize;
-};
-#if _FX_OS_ != _FX_ANDROID_
-#pragma pack(pop)
-#endif
-
-class CFX_DynamicStore : public IFX_MEMAllocator, public CFX_Target {
- public:
- CFX_DynamicStore(size_t iDefChunkSize = 4096);
- virtual ~CFX_DynamicStore();
- virtual void Release() { delete this; }
- virtual void* Alloc(size_t size);
- virtual void Free(void* pBlock);
- virtual size_t GetBlockSize() const { return 0; }
- virtual size_t GetDefChunkSize() const { return m_iDefChunkSize; }
- virtual size_t SetDefChunkSize(size_t size);
- virtual size_t GetCurrentDataSize() const { return 0; }
-
- protected:
- FX_DYNAMICSTORECHUNK* AllocChunk(size_t size);
-
- size_t m_iDefChunkSize;
- FX_DYNAMICSTORECHUNK* m_pChunk;
-};
-
} // namespace
-#define FX_4BYTEALIGN(size) (((size) + 3) / 4 * 4)
+#define FX_4BYTEALIGN(size) (((size) + 3) & ~3)
-IFX_MEMAllocator* FX_CreateAllocator(FX_ALLOCTYPE eType,
- size_t chunkSize,
- size_t blockSize) {
+IFX_MemoryAllocator* IFX_MemoryAllocator::Create(FX_ALLOCTYPE eType,
+ size_t chunkSize,
+ size_t blockSize) {
switch (eType) {
- case FX_ALLOCTYPE_Dynamic:
- return new CFX_DynamicStore(chunkSize);
- case FX_ALLOCTYPE_Default:
- return new CFX_DefStore();
case FX_ALLOCTYPE_Static:
return new CFX_StaticStore(chunkSize);
case FX_ALLOCTYPE_Fixed:
return new CFX_FixedStore(blockSize, chunkSize);
default:
- return NULL;
+ ASSERT(0);
+ return nullptr;
}
}
+
CFX_StaticStore::CFX_StaticStore(size_t iDefChunkSize)
: m_iAllocatedSize(0),
m_iDefChunkSize(iDefChunkSize),
- m_pChunk(NULL),
- m_pLastChunk(NULL) {
+ m_pChunk(nullptr),
+ m_pLastChunk(nullptr) {
ASSERT(m_iDefChunkSize != 0);
}
CFX_StaticStore::~CFX_StaticStore() {
@@ -175,8 +122,8 @@ FX_STATICSTORECHUNK* CFX_StaticStore::AllocChunk(size_t size) {
uint8_t, sizeof(FX_STATICSTORECHUNK) + size);
pChunk->iChunkSize = size;
pChunk->iFreeSize = size;
- pChunk->pNextChunk = NULL;
- if (m_pLastChunk == NULL) {
+ pChunk->pNextChunk = nullptr;
+ if (!m_pLastChunk) {
m_pChunk = pChunk;
} else {
m_pLastChunk->pNextChunk = pChunk;
@@ -186,7 +133,7 @@ FX_STATICSTORECHUNK* CFX_StaticStore::AllocChunk(size_t size) {
}
FX_STATICSTORECHUNK* CFX_StaticStore::FindChunk(size_t size) {
ASSERT(size != 0);
- if (m_pLastChunk == NULL || m_pLastChunk->iFreeSize < size) {
+ if (!m_pLastChunk || m_pLastChunk->iFreeSize < size) {
return AllocChunk(std::max(m_iDefChunkSize, size));
}
return m_pLastChunk;
@@ -211,7 +158,7 @@ size_t CFX_StaticStore::SetDefChunkSize(size_t size) {
CFX_FixedStore::CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk)
: m_iBlockSize(FX_4BYTEALIGN(iBlockSize)),
m_iDefChunkSize(FX_4BYTEALIGN(iBlockNumsInChunk)),
- m_pChunk(NULL) {
+ m_pChunk(nullptr) {
ASSERT(m_iBlockSize != 0 && m_iDefChunkSize != 0);
}
CFX_FixedStore::~CFX_FixedStore() {
@@ -227,9 +174,9 @@ FX_FIXEDSTORECHUNK* CFX_FixedStore::AllocChunk() {
m_iBlockSize * m_iDefChunkSize;
FX_FIXEDSTORECHUNK* pChunk =
(FX_FIXEDSTORECHUNK*)FX_Alloc(uint8_t, iTotalSize);
- if (pChunk == NULL) {
- return NULL;
- }
+ if (!pChunk)
+ return nullptr;
+
FXSYS_memset(pChunk->FirstFlag(), 0, m_iDefChunkSize);
pChunk->pNextChunk = m_pChunk;
pChunk->iChunkSize = m_iDefChunkSize;
@@ -239,19 +186,18 @@ FX_FIXEDSTORECHUNK* CFX_FixedStore::AllocChunk() {
}
void* CFX_FixedStore::Alloc(size_t size) {
if (size > m_iBlockSize) {
- return NULL;
+ return nullptr;
}
FX_FIXEDSTORECHUNK* pChunk = m_pChunk;
- while (pChunk != NULL) {
+ while (pChunk) {
if (pChunk->iFreeNum > 0) {
break;
}
pChunk = pChunk->pNextChunk;
}
- if (pChunk == NULL) {
+ if (!pChunk) {
pChunk = AllocChunk();
}
- ASSERT(pChunk != NULL);
uint8_t* pFlags = pChunk->FirstFlag();
size_t i = 0;
for (; i < pChunk->iChunkSize; i++)
@@ -264,12 +210,11 @@ void* CFX_FixedStore::Alloc(size_t size) {
return pChunk->FirstBlock() + i * m_iBlockSize;
}
void CFX_FixedStore::Free(void* pBlock) {
- ASSERT(pBlock != NULL);
- FX_FIXEDSTORECHUNK* pPrior = NULL;
+ FX_FIXEDSTORECHUNK* pPrior = nullptr;
FX_FIXEDSTORECHUNK* pChunk = m_pChunk;
- uint8_t* pStart = NULL;
+ uint8_t* pStart = nullptr;
uint8_t* pEnd;
- while (pChunk != NULL) {
+ while (pChunk) {
pStart = pChunk->FirstBlock();
if (pBlock >= pStart) {
pEnd = pStart + m_iBlockSize * pChunk->iChunkSize;
@@ -279,7 +224,7 @@ void CFX_FixedStore::Free(void* pBlock) {
}
pPrior = pChunk, pChunk = pChunk->pNextChunk;
}
- ASSERT(pChunk != NULL);
+ ASSERT(pChunk);
size_t iPos = ((uint8_t*)pBlock - pStart) / m_iBlockSize;
ASSERT(iPos < pChunk->iChunkSize);
uint8_t* pFlags = pChunk->FirstFlag();
@@ -289,7 +234,7 @@ void CFX_FixedStore::Free(void* pBlock) {
pFlags[iPos] = 0;
pChunk->iFreeNum++;
if (pChunk->iFreeNum == pChunk->iChunkSize) {
- if (pPrior == NULL) {
+ if (!pPrior) {
m_pChunk = pChunk->pNextChunk;
} else {
pPrior->pNextChunk = pChunk->pNextChunk;
@@ -303,144 +248,5 @@ size_t CFX_FixedStore::SetDefChunkSize(size_t iChunkSize) {
m_iDefChunkSize = FX_4BYTEALIGN(iChunkSize);
return v;
}
-CFX_DynamicStore::CFX_DynamicStore(size_t iDefChunkSize)
- : m_iDefChunkSize(iDefChunkSize), m_pChunk(NULL) {
- ASSERT(m_iDefChunkSize != 0);
-}
-CFX_DynamicStore::~CFX_DynamicStore() {
- FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
- while (pChunk) {
- FX_DYNAMICSTORECHUNK* pNext = pChunk->pNextChunk;
- FX_Free(pChunk);
- pChunk = pNext;
- }
-}
-FX_DYNAMICSTORECHUNK* CFX_DynamicStore::AllocChunk(size_t size) {
- ASSERT(size != 0);
- FX_DYNAMICSTORECHUNK* pChunk = (FX_DYNAMICSTORECHUNK*)FX_Alloc(
- uint8_t,
- sizeof(FX_DYNAMICSTORECHUNK) + sizeof(FX_DYNAMICSTOREBLOCK) * 2 + size);
- if (pChunk == NULL) {
- return NULL;
- }
- pChunk->iChunkSize = size;
- pChunk->iFreeSize = size;
- FX_DYNAMICSTOREBLOCK* pBlock = pChunk->FirstBlock();
- pBlock->iBlockSize = size;
- pBlock->bUsed = FALSE;
- pBlock = pBlock->NextBlock();
- pBlock->iBlockSize = 0;
- pBlock->bUsed = TRUE;
- if (m_pChunk != NULL && size >= m_iDefChunkSize) {
- FX_DYNAMICSTORECHUNK* pLast = m_pChunk;
- while (pLast->pNextChunk != NULL) {
- pLast = pLast->pNextChunk;
- }
- pLast->pNextChunk = pChunk;
- pChunk->pNextChunk = NULL;
- } else {
- pChunk->pNextChunk = m_pChunk;
- m_pChunk = pChunk;
- }
- return pChunk;
-}
-void* CFX_DynamicStore::Alloc(size_t size) {
- size = FX_4BYTEALIGN(size);
- ASSERT(size != 0);
- FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
- FX_DYNAMICSTOREBLOCK* pBlock = NULL;
- while (pChunk != NULL) {
- if (pChunk->iFreeSize >= size) {
- pBlock = pChunk->FirstBlock();
- FX_BOOL bFind = FALSE;
- while (pBlock->iBlockSize != 0) {
- if (!pBlock->bUsed && pBlock->iBlockSize >= size) {
- bFind = TRUE;
- break;
- }
- pBlock = pBlock->NextBlock();
- }
- if (bFind) {
- break;
- }
- }
- pChunk = pChunk->pNextChunk;
- }
- if (pChunk == NULL) {
- pChunk = AllocChunk(std::max(m_iDefChunkSize, size));
- pBlock = pChunk->FirstBlock();
- }
- ASSERT(pChunk != NULL && pBlock != NULL);
- size_t m = size + sizeof(FX_DYNAMICSTOREBLOCK);
- pBlock->bUsed = TRUE;
- if (pBlock->iBlockSize > m) {
- size_t n = pBlock->iBlockSize;
- pBlock->iBlockSize = size;
- FX_DYNAMICSTOREBLOCK* pNextBlock = pBlock->NextBlock();
- pNextBlock->bUsed = FALSE;
- pNextBlock->iBlockSize = n - size - sizeof(FX_DYNAMICSTOREBLOCK);
- pChunk->iFreeSize -= size + sizeof(FX_DYNAMICSTOREBLOCK);
- } else {
- pChunk->iFreeSize -= pBlock->iBlockSize;
- }
- return pBlock->Data();
-}
-void CFX_DynamicStore::Free(void* pBlock) {
- ASSERT(pBlock != NULL);
- FX_DYNAMICSTORECHUNK* pPriorChunk = NULL;
- FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
- while (pChunk != NULL) {
- if (pBlock > pChunk &&
- pBlock <= ((uint8_t*)pChunk + sizeof(FX_DYNAMICSTORECHUNK) +
- pChunk->iChunkSize)) {
- break;
- }
- pPriorChunk = pChunk, pChunk = pChunk->pNextChunk;
- }
- ASSERT(pChunk != NULL);
- FX_DYNAMICSTOREBLOCK* pPriorBlock = NULL;
- FX_DYNAMICSTOREBLOCK* pFindBlock = pChunk->FirstBlock();
- while (pFindBlock->iBlockSize != 0) {
- if (pBlock == (void*)pFindBlock->Data()) {
- break;
- }
- pPriorBlock = pFindBlock;
- pFindBlock = pFindBlock->NextBlock();
- }
- ASSERT(pFindBlock->iBlockSize != 0 && pFindBlock->bUsed &&
- pBlock == (void*)pFindBlock->Data());
- pFindBlock->bUsed = FALSE;
- pChunk->iFreeSize += pFindBlock->iBlockSize;
- if (pPriorBlock == NULL) {
- pPriorBlock = pChunk->FirstBlock();
- } else if (pPriorBlock->bUsed) {
- pPriorBlock = pFindBlock;
- }
- pFindBlock = pPriorBlock;
- size_t sizeFree = 0;
- size_t sizeBlock = 0;
- while (pFindBlock->iBlockSize != 0 && !pFindBlock->bUsed) {
- if (pFindBlock != pPriorBlock) {
- sizeFree += sizeof(FX_DYNAMICSTOREBLOCK);
- sizeBlock += sizeof(FX_DYNAMICSTOREBLOCK);
- }
- sizeBlock += pFindBlock->iBlockSize;
- pFindBlock = pFindBlock->NextBlock();
- }
- pPriorBlock->iBlockSize = sizeBlock;
- pChunk->iFreeSize += sizeFree;
- if (pChunk->iFreeSize == pChunk->iChunkSize) {
- if (pPriorChunk == NULL) {
- m_pChunk = pChunk->pNextChunk;
- } else {
- pPriorChunk->pNextChunk = pChunk->pNextChunk;
- }
- FX_Free(pChunk);
- }
-}
-size_t CFX_DynamicStore::SetDefChunkSize(size_t size) {
- ASSERT(size != 0);
- size_t v = m_iDefChunkSize;
- m_iDefChunkSize = size;
- return v;
-}
+
+#endif // MEMORY_TOOL_REPLACES_ALLOCATOR
diff --git a/xfa/fgas/crt/fgas_memory.h b/xfa/fgas/crt/fgas_memory.h
index ac27755cac..c6c837600b 100644
--- a/xfa/fgas/crt/fgas_memory.h
+++ b/xfa/fgas/crt/fgas_memory.h
@@ -10,39 +10,33 @@
#include "core/fxcrt/include/fx_memory.h"
#include "core/fxcrt/include/fx_system.h"
-class IFX_MEMAllocator;
-class CFX_Target;
enum FX_ALLOCTYPE {
- FX_ALLOCTYPE_Default = 0,
FX_ALLOCTYPE_Static,
FX_ALLOCTYPE_Fixed,
- FX_ALLOCTYPE_Dynamic,
};
-class IFX_MEMAllocator {
+class IFX_MemoryAllocator {
public:
- virtual ~IFX_MEMAllocator() {}
+ virtual ~IFX_MemoryAllocator() {}
virtual void Release() = 0;
+
virtual void* Alloc(size_t size) = 0;
virtual void Free(void* pBlock) = 0;
- virtual size_t GetBlockSize() const = 0;
- virtual size_t GetDefChunkSize() const = 0;
- virtual size_t SetDefChunkSize(size_t size) = 0;
- virtual size_t GetCurrentDataSize() const = 0;
-};
-IFX_MEMAllocator* FX_CreateAllocator(FX_ALLOCTYPE eType,
+ static IFX_MemoryAllocator* Create(FX_ALLOCTYPE eType,
size_t chunkSize,
size_t blockSize);
+};
+
class CFX_Target {
public:
virtual ~CFX_Target() {}
void* operator new(size_t size) { return FX_Alloc(uint8_t, size); }
void operator delete(void* p) { FX_Free(p); }
- void* operator new(size_t size, IFX_MEMAllocator* pAllocator) {
+ void* operator new(size_t size, IFX_MemoryAllocator* pAllocator) {
return pAllocator->Alloc(size);
}
- void operator delete(void* p, IFX_MEMAllocator* pAllocator) {
+ void operator delete(void* p, IFX_MemoryAllocator* pAllocator) {
pAllocator->Free(p);
}
void* operator new(size_t size, void* place) { return place; }
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index 9ed84e1604..bd06421870 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -212,8 +212,8 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer,
if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) {
return;
}
- m_pAllocator =
- FX_CreateAllocator(FX_ALLOCTYPE_Fixed, 32, sizeof(CXFA_CSSTagProvider));
+ m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, 32,
+ sizeof(CXFA_CSSTagProvider));
InitCSSData(pTextProvider);
IFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider);
ParseRichText(pXMLContainer, pRootStyle);
@@ -1272,9 +1272,9 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) {
FX_BOOL CXFA_TextLayout::Loader(const CFX_SizeF& szText,
FX_FLOAT& fLinePos,
FX_BOOL bSavePieces) {
- if (m_pAllocator == NULL) {
- m_pAllocator = FX_CreateAllocator(FX_ALLOCTYPE_Static, 256, 0);
- }
+ if (!m_pAllocator)
+ m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 256, 0);
+
GetTextDataNode();
if (m_pTextDataNode == NULL) {
return TRUE;
diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h
index bc6719a4df..17450ddeab 100644
--- a/xfa/fxfa/app/xfa_textlayout.h
+++ b/xfa/fxfa/app/xfa_textlayout.h
@@ -130,7 +130,7 @@ class CXFA_TextParser {
void ParseTagInfo(CFDE_XMLNode* pXMLNode, CXFA_CSSTagProvider& tagProvider);
IFDE_CSSStyleSheet* LoadDefaultSheetStyle();
IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle);
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
CFDE_CSSStyleSelector* m_pSelector;
IFDE_CSSStyleSheet* m_pUASheet;
CFX_MapPtrTemplate<CFDE_XMLNode*, CXFA_TextParseContext*>
@@ -169,7 +169,7 @@ class CXFA_LoaderContext {
class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target {
public:
- CXFA_LinkUserData(IFX_MEMAllocator* pAllocator, FX_WCHAR* pszText)
+ CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText)
: m_pAllocator(pAllocator), m_dwRefCount(1) {
m_pszURLContent = pszText;
}
@@ -186,14 +186,15 @@ class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target {
const FX_WCHAR* GetLinkURL() { return m_pszURLContent.c_str(); }
protected:
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
uint32_t m_dwRefCount;
CFX_WideString m_pszURLContent;
};
class CXFA_TextUserData : public IFX_Unknown, public CFX_Target {
public:
- CXFA_TextUserData(IFX_MEMAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle)
+ CXFA_TextUserData(IFX_MemoryAllocator* pAllocator,
+ IFDE_CSSComputedStyle* pStyle)
: m_pStyle(pStyle),
m_pLinkData(nullptr),
m_pAllocator(pAllocator),
@@ -202,7 +203,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target {
if (m_pStyle)
m_pStyle->AddRef();
}
- CXFA_TextUserData(IFX_MEMAllocator* pAllocator,
+ CXFA_TextUserData(IFX_MemoryAllocator* pAllocator,
IFDE_CSSComputedStyle* pStyle,
CXFA_LinkUserData* pLinkData)
: m_pStyle(pStyle),
@@ -232,7 +233,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target {
CXFA_LinkUserData* m_pLinkData;
protected:
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
uint32_t m_dwRefCount;
};
@@ -404,7 +405,7 @@ class CXFA_TextLayout {
CXFA_TextProvider* m_pTextProvider;
CXFA_Node* m_pTextDataNode;
FX_BOOL m_bRichText;
- IFX_MEMAllocator* m_pAllocator;
+ IFX_MemoryAllocator* m_pAllocator;
CFX_RTFBreak* m_pBreak;
CXFA_LoaderContext* m_pLoader;
int32_t m_iLines;