diff options
author | tsepez <tsepez@chromium.org> | 2016-05-04 06:13:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 06:13:45 -0700 |
commit | 2a14bde1011a5d374d1109fd83f59a8ff67c162e (patch) | |
tree | e11df29fe4c82e4b502884f5bec8618dfec0491d | |
parent | 4c133f3bce38415597a011f79385ec130c8adbe8 (diff) | |
download | pdfium-2a14bde1011a5d374d1109fd83f59a8ff67c162e.tar.xz |
Replace IFX_MemoryAllocator::Release() with delete.
All Release() did was invoke delete. Add some "overrides"
while we're at it.
Review-Url: https://codereview.chromium.org/1951573002
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 12 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 6 | ||||
-rw-r--r-- | xfa/fee/fde_txtedtbuf.cpp | 8 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_memory.cpp | 21 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_memory.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 15 |
6 files changed, 23 insertions, 41 deletions
diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 01a19267e1..27b251a783 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -223,10 +223,8 @@ CFDE_CSSStyleSelector::CFDE_CSSStyleSelector() CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() { Reset(); - if (m_pInlineStyleStore) - m_pInlineStyleStore->Release(); - if (m_pFixedStyleStore) - m_pFixedStyleStore->Release(); + delete m_pInlineStyleStore; + delete m_pFixedStyleStore; delete m_pAccelerator; } @@ -302,10 +300,8 @@ void CFDE_CSSStyleSelector::Reset() { for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { m_RuleCollection[iGroup].Clear(); } - if (m_pRuleDataStore != NULL) { - m_pRuleDataStore->Release(); - m_pRuleDataStore = NULL; - } + delete m_pRuleDataStore; + m_pRuleDataStore = nullptr; } int32_t CFDE_CSSStyleSelector::MatchDeclarations( CXFA_CSSTagProvider* pTag, diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index db01274d6a..af6872bbaa 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -101,10 +101,8 @@ void CFDE_CSSStyleSheet::Reset() { m_RuleArray.RemoveAll(); m_Selectors.RemoveAll(); m_StringCache.RemoveAll(); - if (m_pAllocator) { - m_pAllocator->Release(); - m_pAllocator = NULL; - } + delete m_pAllocator; + m_pAllocator = nullptr; } uint32_t CFDE_CSSStyleSheet::AddRef() { return ++m_wRefCount; diff --git a/xfa/fee/fde_txtedtbuf.cpp b/xfa/fee/fde_txtedtbuf.cpp index 1369d55be5..c9ad39252b 100644 --- a/xfa/fee/fde_txtedtbuf.cpp +++ b/xfa/fee/fde_txtedtbuf.cpp @@ -122,7 +122,7 @@ void CFDE_TxtEdtBuf::Release() { } CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { Clear(TRUE); - m_pAllocator->Release(); + delete m_pAllocator; m_Chunks.RemoveAll(); } FX_BOOL CFDE_TxtEdtBuf::SetChunkSize(int32_t nChunkSize) { @@ -362,10 +362,8 @@ void CFDE_TxtEdtBuf::ResetChunkBuffer(int32_t nDefChunkCount, int32_t nChunkSize) { ASSERT(nChunkSize); ASSERT(nDefChunkCount); - if (m_pAllocator) { - m_pAllocator->Release(); - m_pAllocator = NULL; - } + delete m_pAllocator; + m_pAllocator = nullptr; m_Chunks.RemoveAll(); m_nChunkSize = nChunkSize; int32_t nChunkLength = diff --git a/xfa/fgas/crt/fgas_memory.cpp b/xfa/fgas/crt/fgas_memory.cpp index 04c4b31dd0..2bd1e4da83 100644 --- a/xfa/fgas/crt/fgas_memory.cpp +++ b/xfa/fgas/crt/fgas_memory.cpp @@ -17,10 +17,9 @@ namespace { 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); } + ~CFX_DefStore() override {} + void* Alloc(size_t size) override { return FX_Alloc(uint8_t, size); } + void Free(void* pBlock) override { FX_Free(pBlock); } }; } // namespace @@ -44,10 +43,9 @@ struct FX_STATICSTORECHUNK { 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) {} + ~CFX_StaticStore() override; + void* Alloc(size_t size) override; + void Free(void* pBlock) override {} protected: size_t m_iAllocatedSize; @@ -70,10 +68,9 @@ struct FX_FIXEDSTORECHUNK { 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); + ~CFX_FixedStore() override; + void* Alloc(size_t size) override; + void Free(void* pBlock) override; protected: FX_FIXEDSTORECHUNK* AllocChunk(); diff --git a/xfa/fgas/crt/fgas_memory.h b/xfa/fgas/crt/fgas_memory.h index c6c837600b..a83933c7a5 100644 --- a/xfa/fgas/crt/fgas_memory.h +++ b/xfa/fgas/crt/fgas_memory.h @@ -18,8 +18,6 @@ enum FX_ALLOCTYPE { class IFX_MemoryAllocator { public: virtual ~IFX_MemoryAllocator() {} - virtual void Release() = 0; - virtual void* Alloc(size_t size) = 0; virtual void Free(void* pBlock) = 0; diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index bd06421870..01b16a93a2 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -37,8 +37,7 @@ CXFA_TextParser::~CXFA_TextParser() { m_pUASheet->Release(); if (m_pSelector) m_pSelector->Release(); - if (m_pAllocator) - m_pAllocator->Release(); + delete m_pAllocator; FX_POSITION ps = m_mapXMLNodeToParseContext.GetStartPosition(); while (ps) { CFDE_XMLNode* pXMLNode; @@ -59,10 +58,8 @@ void CXFA_TextParser::Reset() { FXTARGET_DeleteWith(CXFA_TextParseContext, m_pAllocator, pParseContext); } m_mapXMLNodeToParseContext.RemoveAll(); - if (m_pAllocator) { - m_pAllocator->Release(); - m_pAllocator = NULL; - } + delete m_pAllocator; + m_pAllocator = nullptr; } void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { if (pTextProvider == NULL) { @@ -665,10 +662,8 @@ void CXFA_TextLayout::Unload() { m_pBreak->Release(); m_pBreak = NULL; } - if (m_pAllocator) { - m_pAllocator->Release(); - m_pAllocator = NULL; - } + delete m_pAllocator; + m_pAllocator = nullptr; } const CXFA_PieceLineArray* CXFA_TextLayout::GetPieceLines() { return &m_pieceLines; |