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

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 2368433003: Make CPDF_ColorSpace::Load() return a unique_ptr (Closed)
Patch Set: Created 4 years, 3 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
Index: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index e050060a9e4befcb46a0ec38ff33a5a35241334e..77c18df5fa2dbff067d5e3e8e391e6228cf78d19 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -76,7 +76,7 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) {
continue;
if (bForceRelease || csData->use_count() < 2) {
- csData->get()->ReleaseCS();
+ csData->get()->Release();
csData->reset(nullptr);
}
}
@@ -294,15 +294,16 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl(
}
}
- CPDF_ColorSpace* pCS = CPDF_ColorSpace::Load(m_pPDFDoc, pArray);
+ std::unique_ptr<CPDF_ColorSpace> pCS =
+ CPDF_ColorSpace::Load(m_pPDFDoc, pArray);
if (!pCS)
return nullptr;
if (!csData) {
- csData = new CPDF_CountedColorSpace(pCS);
+ csData = new CPDF_CountedColorSpace(pCS.release());
m_ColorSpaceMap[pCSObj] = csData;
} else {
- csData->reset(pCS);
+ csData->reset(pCS.release());
}
return csData->AddRef();
}
@@ -335,7 +336,7 @@ void CPDF_DocPageData::ReleaseColorSpace(const CPDF_Object* pColorSpace) {
return;
// We have item only in m_ColorSpaceMap cache. Clean it.
- pCountedColorSpace->get()->ReleaseCS();
+ pCountedColorSpace->get()->Release();
pCountedColorSpace->reset(nullptr);
}

Powered by Google App Engine
This is Rietveld 408576698