summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-18 14:16:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-18 14:16:03 -0700
commit87144d3fc81769578fbfae89f7b99bab89229a57 (patch)
tree5b1a9b8d4b721a5dfbd91593a141d3c4e4256953 /xfa/fde
parent0aae2a773cf51632b7808ab0e5b5c1635cf6a5fa (diff)
downloadpdfium-87144d3fc81769578fbfae89f7b99bab89229a57.tar.xz
Remove Release() from CFDE_TxtEdit* classes
Review-Url: https://codereview.chromium.org/1987223003
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/cfde_txtedtbuf.cpp4
-rw-r--r--xfa/fde/cfde_txtedtbuf.h5
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp27
-rw-r--r--xfa/fde/cfde_txtedtengine.h6
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp4
-rw-r--r--xfa/fde/cfde_txtedtpage.h5
-rw-r--r--xfa/fde/ifde_txtedtpage.h3
7 files changed, 9 insertions, 45 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,