Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: core/fpdfapi/parser/cpdf_data_avail.cpp

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_array_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_data_avail.cpp
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index da7f6948a3ee9b40825aeca83636b3a9bfbb9eed..89ae5a4791d5a9f955e34021b95f8a064eec8f0f 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -82,18 +82,13 @@ CPDF_DataAvail::CPDF_DataAvail(FileAvail* pFileAvail,
}
CPDF_DataAvail::~CPDF_DataAvail() {
m_pHintTables.reset();
- if (m_pLinearized)
- m_pLinearized->Release();
-
- if (m_pRoot)
- m_pRoot->Release();
-
- if (m_pTrailer)
- m_pTrailer->Release();
+ delete m_pLinearized;
+ delete m_pRoot;
+ delete m_pTrailer;
int iSize = m_arrayAcroforms.GetSize();
for (int i = 0; i < iSize; ++i)
- m_arrayAcroforms.GetAt(i)->Release();
+ delete m_arrayAcroforms.GetAt(i);
}
void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
@@ -236,7 +231,7 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(DownloadHints* pHints) {
if (bRet) {
int32_t iSize = m_arrayAcroforms.GetSize();
for (int32_t i = 0; i < iSize; ++i) {
- m_arrayAcroforms.GetAt(i)->Release();
+ delete m_arrayAcroforms.GetAt(i);
}
m_arrayAcroforms.RemoveAll();
} else {
@@ -410,9 +405,7 @@ FX_BOOL CPDF_DataAvail::CheckInfo(DownloadHints* pHints) {
return FALSE;
}
- if (pInfo)
- pInfo->Release();
-
+ delete pInfo;
m_docStatus =
(m_bHaveAcroForm ? PDF_DATAAVAIL_ACROFORM : PDF_DATAAVAIL_PAGETREE);
@@ -509,7 +502,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
}
if (!pObj->IsDictionary()) {
- pObj->Release();
+ delete pObj;
continue;
}
@@ -518,7 +511,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
m_PagesArray.Add(pObj);
continue;
}
- pObj->Release();
+ delete pObj;
}
m_PageObjList.RemoveAll();
@@ -534,17 +527,17 @@ FX_BOOL CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
continue;
if (!GetPageKids(m_pCurrentParser, pPages)) {
- pPages->Release();
+ delete pPages;
while (++i < iPages) {
pPages = m_PagesArray.GetAt(i);
- pPages->Release();
+ delete pPages;
}
m_PagesArray.RemoveAll();
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- pPages->Release();
+ delete pPages;
}
m_PagesArray.RemoveAll();
@@ -599,12 +592,12 @@ FX_BOOL CPDF_DataAvail::CheckPages(DownloadHints* pHints) {
}
if (!GetPageKids(m_pCurrentParser, pPages)) {
- pPages->Release();
+ delete pPages;
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- pPages->Release();
+ delete pPages;
m_docStatus = PDF_DATAAVAIL_PAGE;
return TRUE;
}
@@ -775,7 +768,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(DownloadHints* pHints) {
std::unique_ptr<CPDF_HintTables> pHintTables(
new CPDF_HintTables(this, pDict));
- std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream(
+ std::unique_ptr<CPDF_Object> pHintStream(
ParseIndirectObjectAt(szHintStart, 0));
CPDF_Stream* pStream = ToStream(pHintStream.get());
if (pStream && pHintTables->LoadHintStream(pStream))
@@ -963,11 +956,11 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
if (pName->GetString() == "XRef") {
m_Pos += m_parser.m_pSyntax->SavePos();
xref_offset = pObj->GetDict()->GetIntegerFor("Prev");
- pObj->Release();
+ delete pObj;
return 1;
}
}
- pObj->Release();
+ delete pObj;
return -1;
}
pHints->AddSegment(m_Pos, req_size);
@@ -1193,7 +1186,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
m_syntaxParser.InitParser(file.get(), 0);
- std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer(
+ std::unique_ptr<CPDF_Object> pTrailer(
m_syntaxParser.GetObject(nullptr, 0, 0, true));
if (!pTrailer) {
m_Pos += m_syntaxParser.SavePos();
@@ -1278,7 +1271,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo,
CPDF_Array* pArray = pPages->AsArray();
if (!pArray) {
- pPages->Release();
+ delete pPages;
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
@@ -1293,7 +1286,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo,
pPageNode->m_childNode.Add(pNode);
pNode->m_dwPageNo = pKid->GetRefObjNum();
}
- pPages->Release();
+ delete pPages;
return TRUE;
}
@@ -1316,12 +1309,12 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
if (pPage->IsArray()) {
pPageNode->m_dwPageNo = dwPageNo;
pPageNode->m_type = PDF_PAGENODE_ARRAY;
- pPage->Release();
+ delete pPage;
return TRUE;
}
if (!pPage->IsDictionary()) {
- pPage->Release();
+ delete pPage;
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
@@ -1362,11 +1355,11 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
} else if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
} else {
- pPage->Release();
+ delete pPage;
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- pPage->Release();
+ delete pPage;
return TRUE;
}
@@ -1454,23 +1447,23 @@ FX_BOOL CPDF_DataAvail::CheckPageCount(DownloadHints* pHints) {
CPDF_Dictionary* pPagesDict = pPages->GetDict();
if (!pPagesDict) {
- pPages->Release();
+ delete pPages;
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
if (!pPagesDict->KeyExist("Kids")) {
- pPages->Release();
+ delete pPages;
return TRUE;
}
int count = pPagesDict->GetIntegerFor("Count");
if (count > 0) {
- pPages->Release();
+ delete pPages;
return TRUE;
}
- pPages->Release();
+ delete pPages;
return FALSE;
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_array_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698