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

Unified Diff: core/fxcodec/codec/fx_codec.cpp

Issue 2572843002: Return unique_ptr<>s from fxcodec/ (Closed)
Patch Set: std::move it 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
Index: core/fxcodec/codec/fx_codec.cpp
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 2f4a81155c76af5ecd7fcd5574b368c8a4f74bb4..aa2ecef34576ce49c4ed8da5b1f48cba07ee7393 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -14,6 +14,7 @@
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/logging.h"
+#include "third_party/base/ptr_util.h"
CCodec_ModuleMgr::CCodec_ModuleMgr()
: m_pBasicModule(new CCodec_BasicModule),
@@ -302,19 +303,16 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
m_Operator = 257 - count;
}
-CCodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(
- const uint8_t* src_buf,
- uint32_t src_size,
- int width,
- int height,
- int nComps,
- int bpc) {
- std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder(
- new CCodec_RLScanlineDecoder);
- if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
- bpc)) {
+std::unique_ptr<CCodec_ScanlineDecoder>
+CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ int bpc) {
+ auto pDecoder = pdfium::MakeUnique<CCodec_RLScanlineDecoder>();
+ if (!pDecoder->Create(src_buf, src_size, width, height, nComps, bpc))
return nullptr;
- }
- return pRLScanlineDecoder.release();
+ return std::move(pDecoder);
}

Powered by Google App Engine
This is Rietveld 408576698