diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-25 12:03:18 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-25 19:16:31 +0000 |
commit | 797ca5cad52edde7c65da45a15216f20b1bfd8fd (patch) | |
tree | 811a96d5f505e7cff89395cea7dff89604fc9133 /core/fpdfapi | |
parent | 3a4c408554f2f2ffb5a143f6dadcdd528fcf106e (diff) | |
download | pdfium-797ca5cad52edde7c65da45a15216f20b1bfd8fd.tar.xz |
Mass conversion of all const-lifetime class members
Sed + minimal conversions to compile, including moving some
constructors into the .cpp file. Any that caused ASAN issues
during the tests were omitted rather than trying to resolve
the underlying issue.
Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335
Reviewed-on: https://pdfium-review.googlesource.com/5891
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/font/font_int.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_iccprofile.h | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_meshstream.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.h | 5 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_progressiverenderer.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_progressiverenderer.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_type3cache.h | 2 |
9 files changed, 19 insertions, 16 deletions
diff --git a/core/fpdfapi/font/font_int.h b/core/fpdfapi/font/font_int.h index f434f2b41d..ebd08e258a 100644 --- a/core/fpdfapi/font/font_int.h +++ b/core/fpdfapi/font/font_int.h @@ -150,7 +150,7 @@ class CPDF_CMapParser { const CFX_ByteStringC& first, const CFX_ByteStringC& second); - CPDF_CMap* const m_pCMap; + CFX_UnownedPtr<CPDF_CMap> const m_pCMap; int m_Status; int m_CodeSeq; uint32_t m_CodePoints[4]; diff --git a/core/fpdfapi/page/cpdf_iccprofile.h b/core/fpdfapi/page/cpdf_iccprofile.h index 05ac9bf1ba..a0cf744b9c 100644 --- a/core/fpdfapi/page/cpdf_iccprofile.h +++ b/core/fpdfapi/page/cpdf_iccprofile.h @@ -8,6 +8,7 @@ #define CORE_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_ #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_unowned_ptr.h" class CPDF_Stream; @@ -16,7 +17,7 @@ class CPDF_IccProfile : public CFX_Retainable { template <typename T, typename... Args> friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); - CPDF_Stream* GetStream() const { return m_pStream; } + CPDF_Stream* GetStream() const { return m_pStream.Get(); } bool IsValid() const { return IsSRGB() || IsSupported(); } bool IsSRGB() const { return m_bsRGB; } bool IsSupported() const { return !!m_pTransform; } @@ -28,7 +29,7 @@ class CPDF_IccProfile : public CFX_Retainable { ~CPDF_IccProfile() override; const bool m_bsRGB; - CPDF_Stream* const m_pStream; + CFX_UnownedPtr<CPDF_Stream> const m_pStream; void* m_pTransform = nullptr; uint32_t m_nSrcComponents = 0; }; diff --git a/core/fpdfapi/page/cpdf_meshstream.h b/core/fpdfapi/page/cpdf_meshstream.h index e02c3bb4e8..af636a964d 100644 --- a/core/fpdfapi/page/cpdf_meshstream.h +++ b/core/fpdfapi/page/cpdf_meshstream.h @@ -67,8 +67,8 @@ class CPDF_MeshStream { const ShadingType m_type; const std::vector<std::unique_ptr<CPDF_Function>>& m_funcs; - CPDF_Stream* const m_pShadingStream; - CPDF_ColorSpace* const m_pCS; + CFX_UnownedPtr<CPDF_Stream> const m_pShadingStream; + CFX_UnownedPtr<CPDF_ColorSpace> const m_pCS; uint32_t m_nCoordBits; uint32_t m_nComponentBits; uint32_t m_nFlagBits; diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index 5bfdd186c4..bc03cb097b 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -27,7 +27,7 @@ class CPDF_StreamAcc : public CFX_Retainable { uint32_t estimated_size = 0, bool bImageAcc = false); - const CPDF_Stream* GetStream() const { return m_pStream; } + const CPDF_Stream* GetStream() const { return m_pStream.Get(); } CPDF_Dictionary* GetDict() const { return m_pStream ? m_pStream->GetDict() : nullptr; } @@ -47,7 +47,7 @@ class CPDF_StreamAcc : public CFX_Retainable { bool m_bNewBuf; CFX_ByteString m_ImageDecoder; CPDF_Dictionary* m_pImageParam; - const CPDF_Stream* const m_pStream; + CFX_UnownedPtr<const CPDF_Stream> const m_pStream; uint8_t* m_pSrcData; }; diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index 626e24bd2e..a874212392 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -10,6 +10,7 @@ #include <map> #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" class CFX_DIBitmap; @@ -29,7 +30,7 @@ class CPDF_PageRenderCache { uint32_t GetTimeCount() const { return m_nTimeCount; } void ResetBitmap(const CFX_RetainPtr<CPDF_Image>& pImage, const CFX_RetainPtr<CFX_DIBitmap>& pBitmap); - CPDF_Page* GetPage() const { return m_pPage; } + CPDF_Page* GetPage() const { return m_pPage.Get(); } CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { return m_pCurImageCacheEntry; } @@ -45,7 +46,7 @@ class CPDF_PageRenderCache { private: void ClearImageCacheEntry(CPDF_Stream* pStream); - CPDF_Page* const m_pPage; + CFX_UnownedPtr<CPDF_Page> const m_pPage; CPDF_ImageCacheEntry* m_pCurImageCacheEntry; std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; uint32_t m_nTimeCount; diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp index c3cef1fc77..4505db6874 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp +++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp @@ -53,8 +53,9 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pCurrentLayer->m_pObjectHolder->GetPageObjectList()->end(); m_pRenderStatus = pdfium::MakeUnique<CPDF_RenderStatus>(); m_pRenderStatus->Initialize( - m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions, - m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, nullptr); + m_pContext.Get(), m_pDevice.Get(), nullptr, nullptr, nullptr, nullptr, + m_pOptions, m_pCurrentLayer->m_pObjectHolder->m_Transparency, false, + nullptr); m_pDevice->SaveState(); m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); CFX_Matrix device2object; diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.h b/core/fpdfapi/render/cpdf_progressiverenderer.h index f0b1579601..cadbd2d089 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.h +++ b/core/fpdfapi/render/cpdf_progressiverenderer.h @@ -47,8 +47,8 @@ class CPDF_ProgressiveRenderer { static const int kStepLimit = 100; Status m_Status; - CPDF_RenderContext* const m_pContext; - CFX_RenderDevice* const m_pDevice; + CFX_UnownedPtr<CPDF_RenderContext> const m_pContext; + CFX_UnownedPtr<CFX_RenderDevice> const m_pDevice; const CPDF_RenderOptions* const m_pOptions; std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus; CFX_FloatRect m_ClipRect; diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 1d2218c166..7c17ff56b4 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -82,11 +82,11 @@ class CPDF_RefType3Cache { ~CPDF_RefType3Cache() { while (m_dwCount--) - ReleaseCachedType3(m_pType3Font); + ReleaseCachedType3(m_pType3Font.Get()); } uint32_t m_dwCount; - CPDF_Type3Font* const m_pType3Font; + CFX_UnownedPtr<CPDF_Type3Font> const m_pType3Font; }; uint32_t CountOutputs( diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h index 3c7d95b8c0..36a1d6f98a 100644 --- a/core/fpdfapi/render/cpdf_type3cache.h +++ b/core/fpdfapi/render/cpdf_type3cache.h @@ -38,7 +38,7 @@ class CPDF_Type3Cache : public CFX_Retainable { float retinaScaleX, float retinaScaleY); - CPDF_Type3Font* const m_pFont; + CFX_UnownedPtr<CPDF_Type3Font> const m_pFont; std::map<CFX_ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap; }; |