diff options
author | tsepez <tsepez@chromium.org> | 2016-05-18 14:16:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 14:16:03 -0700 |
commit | 87144d3fc81769578fbfae89f7b99bab89229a57 (patch) | |
tree | 5b1a9b8d4b721a5dfbd91593a141d3c4e4256953 | |
parent | 0aae2a773cf51632b7808ab0e5b5c1635cf6a5fa (diff) | |
download | pdfium-87144d3fc81769578fbfae89f7b99bab89229a57.tar.xz |
Remove Release() from CFDE_TxtEdit* classes
Review-Url: https://codereview.chromium.org/1987223003
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.cpp | 4 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.h | 5 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 27 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.h | 6 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.cpp | 4 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.h | 5 | ||||
-rw-r--r-- | xfa/fde/ifde_txtedtpage.h | 3 | ||||
-rw-r--r-- | xfa/fwl/basewidget/fwl_editimp.cpp | 5 |
8 files changed, 10 insertions, 49 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 8bd5c1d37b..2f747a30cc 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -24,10 +24,6 @@ CFDE_TxtEdtBuf::CFDE_TxtEdtBuf() ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize); } -void CFDE_TxtEdtBuf::Release() { - delete this; -} - CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { Clear(TRUE); delete m_pAllocator; diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 0007fa4acd..1d8e48e338 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -16,8 +16,8 @@ class IFX_Pause; class CFDE_TxtEdtBuf { public: CFDE_TxtEdtBuf(); + ~CFDE_TxtEdtBuf(); - void Release(); FX_BOOL SetChunkSize(int32_t nChunkSize); int32_t GetChunkSize() const; int32_t GetTextLength() const; @@ -34,9 +34,6 @@ class CFDE_TxtEdtBuf { FX_BOOL Optimize(IFX_Pause* pPause = nullptr); - protected: - ~CFDE_TxtEdtBuf(); - private: friend class CFDE_TxtEdtBufIter; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 3162d397ee..9781d60bf8 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -47,10 +47,7 @@ CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() } CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { - if (m_pTxtBuf) { - m_pTxtBuf->Release(); - m_pTxtBuf = NULL; - } + delete m_pTxtBuf; if (m_pTextBreak) { m_pTextBreak->Release(); m_pTextBreak = NULL; @@ -61,10 +58,6 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { ClearSelection(); } -void CFDE_TxtEdtEngine::Release() { - delete this; -} - void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { if (!m_pTextBreak) m_pTextBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); @@ -994,21 +987,14 @@ void CFDE_TxtEdtEngine::RebuildParagraphs() { } void CFDE_TxtEdtEngine::RemoveAllParags() { - int32_t nCount = m_ParagPtrArray.GetSize(); - for (int i = 0; i < nCount; ++i) + for (int32_t i = 0; i < m_ParagPtrArray.GetSize(); ++i) delete m_ParagPtrArray[i]; m_ParagPtrArray.RemoveAll(); } void CFDE_TxtEdtEngine::RemoveAllPages() { - int32_t nCount = m_PagePtrArray.GetSize(); - int32_t i = 0; - for (i = 0; i < nCount; i++) { - IFDE_TxtEdtPage* pPage = m_PagePtrArray[i]; - if (pPage) { - pPage->Release(); - } - } + for (int32_t i = 0; i < m_PagePtrArray.GetSize(); i++) + delete m_PagePtrArray[i]; m_PagePtrArray.RemoveAll(); } @@ -1043,10 +1029,7 @@ void CFDE_TxtEdtEngine::UpdatePages() { IFDE_TxtEdtPage* pPage = NULL; int32_t i = 0; for (i = nSize - 1; i >= nPageCount; i--) { - pPage = m_PagePtrArray[i]; - if (pPage) { - pPage->Release(); - } + delete m_PagePtrArray[i]; m_PagePtrArray.RemoveAt(i); } return; diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index afe55ce505..15d0f0cc77 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -18,8 +18,7 @@ class IFX_CharIter; class CFDE_TxtEdtEngine { public: CFDE_TxtEdtEngine(); - - void Release(); + ~CFDE_TxtEdtEngine(); void SetEditParams(const FDE_TXTEDTPARAMS& params); FDE_TXTEDTPARAMS* GetEditParams(); @@ -84,9 +83,6 @@ class CFDE_TxtEdtEngine { int32_t& nStartLine) const; FX_WCHAR GetAliasChar() const { return m_wcAliasChar; } - protected: - ~CFDE_TxtEdtEngine(); - private: friend class CFDE_TxtEdtDoRecord_Insert; friend class CFDE_TxtEdtDoRecord_DeleteRange; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index b018d30bad..8535459eb1 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -52,10 +52,6 @@ CFDE_TxtEdtPage::~CFDE_TxtEdtPage() { delete[] m_pCharWidth; } -void CFDE_TxtEdtPage::Release() { - delete this; -} - CFDE_TxtEdtEngine* CFDE_TxtEdtPage::GetEngine() const { return m_pEditEngine; } diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 8be940f556..ea329bff13 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -26,9 +26,9 @@ class CFDE_TxtEdtTextSet; class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { public: CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex); + ~CFDE_TxtEdtPage() override; // IFDE_TxtEditPage: - void Release() override; CFDE_TxtEdtEngine* GetEngine() const override; int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, @@ -67,9 +67,6 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { FX_WCHAR GetChar(void* pIdentity, int32_t index) const override; int32_t GetWidth(void* pIdentity, int32_t index) const override; - protected: - virtual ~CFDE_TxtEdtPage(); - private: void NormalizePt2Rect(CFX_PointF& ptF, const CFX_RectF& rtF, diff --git a/xfa/fde/ifde_txtedtpage.h b/xfa/fde/ifde_txtedtpage.h index 7dddea2709..9db2da77d1 100644 --- a/xfa/fde/ifde_txtedtpage.h +++ b/xfa/fde/ifde_txtedtpage.h @@ -16,8 +16,7 @@ class CFDE_TxtEdtEngine; class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess { public: static IFDE_TxtEdtPage* Create(CFDE_TxtEdtEngine* pEngine, int32_t nIndex); - - virtual void Release() = 0; + ~IFDE_TxtEdtPage() override {} virtual CFDE_TxtEdtEngine* GetEngine() const = 0; virtual int32_t GetCharRect(int32_t nIndex, diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 4e753b1f9f..b734ec6e77 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -222,10 +222,7 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, } CFWL_EditImp::~CFWL_EditImp() { - if (m_pEdtEngine) { - m_pEdtEngine->Release(); - m_pEdtEngine = NULL; - } + delete m_pEdtEngine; ClearRecord(); } |