From c6c2e36f59f54b17d9e2c54a2003166e79ccb5e6 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 19 Sep 2016 12:08:38 -0700 Subject: Remove CPDF_Object::Destroy { delete this; } We can delete this just fine on our own. Review-Url: https://codereview.chromium.org/2355593002 --- core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp | 10 +++++----- core/fpdfapi/fpdf_parser/cpdf_object.cpp | 2 +- core/fpdfapi/fpdf_parser/include/cpdf_object.h | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp index 711b3da614..dc639feb1a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp @@ -13,7 +13,7 @@ CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder() : m_LastObjNum(0) {} CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() { for (const auto& pair : m_IndirectObjs) - pair.second->Destroy(); + delete pair.second; } CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject( @@ -38,7 +38,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::GetOrParseIndirectObject( pObj->m_ObjNum = objnum; m_LastObjNum = std::max(m_LastObjNum, objnum); if (m_IndirectObjs[objnum]) - m_IndirectObjs[objnum]->Destroy(); + delete m_IndirectObjs[objnum]; m_IndirectObjs[objnum] = pObj; return pObj; @@ -67,10 +67,10 @@ bool CPDF_IndirectObjectHolder::ReplaceIndirectObjectIfHigherGeneration( CPDF_Object* pOldObj = GetIndirectObject(objnum); if (pOldObj) { if (pObj->GetGenNum() <= pOldObj->GetGenNum()) { - pObj->Destroy(); + delete pObj; return false; } - pOldObj->Destroy(); + delete pOldObj; } pObj->m_ObjNum = objnum; m_IndirectObjs[objnum] = pObj; @@ -83,6 +83,6 @@ void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) { if (!pObj || pObj->GetObjNum() == CPDF_Object::kInvalidObjNum) return; - pObj->Destroy(); + delete pObj; m_IndirectObjs.erase(objnum); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_object.cpp b/core/fpdfapi/fpdf_parser/cpdf_object.cpp index 7da12a2b4f..442aaeda76 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object.cpp @@ -41,7 +41,7 @@ void CPDF_Object::Release() { if (m_ObjNum) return; - Destroy(); + delete this; } CFX_ByteString CPDF_Object::GetString() const { diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h index 8d9bb01119..115ce02200 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h @@ -95,7 +95,6 @@ class CPDF_Object { CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} virtual ~CPDF_Object(); - void Destroy() { delete this; } CPDF_Object* CloneObjectNonCyclic(bool bDirect) const; -- cgit v1.2.3