From 26cb2fa42b1a90146f9ab5c0b83ee8b48703baf4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 30 May 2017 15:29:21 -0700 Subject: Use unowned ptr back to delegates in codec modules Change-Id: I8e31305dcf888665cb0656ac518f07541566b177 Reviewed-on: https://pdfium-review.googlesource.com/6084 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcodec/codec/ccodec_bmpmodule.h | 5 +++-- core/fxcodec/codec/ccodec_gifmodule.h | 5 +++-- core/fxcodec/codec/ccodec_pngmodule.h | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h index bdf6544251..c9fcabb2bd 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.h +++ b/core/fxcodec/codec/ccodec_bmpmodule.h @@ -7,6 +7,7 @@ #ifndef CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_ #define CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_ +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CFX_DIBAttribute; @@ -38,11 +39,11 @@ class CCodec_BmpModule { uint32_t** pal_pp, CFX_DIBAttribute* pAttribute); int32_t LoadImage(FXBMP_Context* pContext); - Delegate* GetDelegate() const { return m_pDelegate; } + Delegate* GetDelegate() const { return m_pDelegate.Get(); } void SetDelegate(Delegate* pDelegate) { m_pDelegate = pDelegate; } protected: - Delegate* m_pDelegate; + CFX_UnownedPtr m_pDelegate; char m_szLastError[256]; }; diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h index 5f3f45f83f..2ccd4f407a 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.h +++ b/core/fxcodec/codec/ccodec_gifmodule.h @@ -10,6 +10,7 @@ #include #include "core/fxcodec/lgif/fx_gif.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" @@ -54,11 +55,11 @@ class CCodec_GifModule { int frame_num, CFX_DIBAttribute* pAttribute); - Delegate* GetDelegate() const { return m_pDelegate; } + Delegate* GetDelegate() const { return m_pDelegate.Get(); } void SetDelegate(Delegate* pDelegate) { m_pDelegate = pDelegate; } protected: - Delegate* m_pDelegate; + CFX_UnownedPtr m_pDelegate; char m_szLastError[256]; }; diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h index f0a08db66c..2b43f5d8bc 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.h +++ b/core/fxcodec/codec/ccodec_pngmodule.h @@ -7,6 +7,7 @@ #ifndef CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ #define CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CFX_DIBAttribute; @@ -38,11 +39,11 @@ class CCodec_PngModule { uint32_t src_size, CFX_DIBAttribute* pAttribute); - Delegate* GetDelegate() const { return m_pDelegate; } + Delegate* GetDelegate() const { return m_pDelegate.Get(); } void SetDelegate(Delegate* delegate) { m_pDelegate = delegate; } protected: - Delegate* m_pDelegate; + CFX_UnownedPtr m_pDelegate; char m_szLastError[PNG_ERROR_SIZE]; }; -- cgit v1.2.3