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

Unified Diff: core/fpdfapi/render/fpdf_render_loadimage.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase 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/render/cpdf_scaledrenderbuffer.cpp ('k') | core/fpdfdoc/cpdf_variabletext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/render/fpdf_render_loadimage.cpp
diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp
index 085077f2e90a7f215115f0bbbc839ca6ba33c40a..4a018a849d605ac686d96477d4c5d9fd56e84c53 100644
--- a/core/fpdfapi/render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp
@@ -22,6 +22,7 @@
#include "core/fpdfapi/render/cpdf_renderstatus.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_safe_types.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -171,7 +172,7 @@ bool CPDF_DIBSource::Load(CPDF_Document* pDoc,
if (!src_size.IsValid()) {
return false;
}
- m_pStreamAcc.reset(new CPDF_StreamAcc);
+ m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return false;
@@ -293,7 +294,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
if (!src_size.IsValid()) {
return 0;
}
- m_pStreamAcc.reset(new CPDF_StreamAcc);
+ m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
m_pStreamAcc->LoadAllData(pStream, false, src_size.ValueOrDie(), true);
if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return 0;
@@ -335,12 +336,12 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
}
CCodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
if (!m_pJbig2Context) {
- m_pJbig2Context.reset(new CCodec_Jbig2Context());
+ m_pJbig2Context = pdfium::MakeUnique<CCodec_Jbig2Context>();
if (m_pStreamAcc->GetImageParam()) {
CPDF_Stream* pGlobals =
m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals");
if (pGlobals) {
- m_pGlobalStream.reset(new CPDF_StreamAcc);
+ m_pGlobalStream = pdfium::MakeUnique<CPDF_StreamAcc>();
m_pGlobalStream->LoadAllData(pGlobals, false);
}
}
@@ -676,7 +677,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
format = FXDIB_Rgb;
}
- m_pCachedBitmap.reset(new CFX_DIBitmap);
+ m_pCachedBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
if (!m_pCachedBitmap->Create(width, height, format)) {
m_pCachedBitmap.reset();
return;
« no previous file with comments | « core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp ('k') | core/fpdfdoc/cpdf_variabletext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698