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

Unified Diff: core/fpdfapi/page/cpdf_image.cpp

Issue 2571313002: Remove some usage of |return XXX.release()| anti-pattern. (Closed)
Patch Set: Android build Created 4 years 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/page/cpdf_image.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/page/cpdf_image.cpp
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index c910319aba347c8faa0b3bf7f2d368d66f27e43f..feafde3b36bcfcaa8158fab2fb8602a013802463 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -322,18 +322,18 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
pPage->GetRenderCache()->ResetBitmap(m_pStream.Get(), pBitmap);
}
-CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask,
- uint32_t* pMatteColor,
- bool bStdCS,
- uint32_t GroupFamily,
- bool bLoadMask) const {
+std::unique_ptr<CFX_DIBSource> CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask,
+ uint32_t* pMatteColor,
+ bool bStdCS,
+ uint32_t GroupFamily,
+ bool bLoadMask) const {
auto source = pdfium::MakeUnique<CPDF_DIBSource>();
- if (source->Load(m_pDocument, m_pStream.Get(),
- reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor,
- nullptr, nullptr, bStdCS, GroupFamily, bLoadMask)) {
- return source.release();
+ if (!source->Load(m_pDocument, m_pStream.Get(),
+ reinterpret_cast<CPDF_DIBSource**>(ppMask), pMatteColor,
+ nullptr, nullptr, bStdCS, GroupFamily, bLoadMask)) {
+ return nullptr;
}
- return nullptr;
+ return std::move(source);
}
CFX_DIBSource* CPDF_Image::DetachBitmap() {
« no previous file with comments | « core/fpdfapi/page/cpdf_image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698