diff options
author | weili <weili@chromium.org> | 2016-08-04 15:43:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-04 15:43:59 -0700 |
commit | cddf8253692d3beaa97a502c8b60c1d18f81664a (patch) | |
tree | baa5b2456a1bdfec97fa97be2ef07eb3295a82d7 /xfa/fde/css/fde_cssstyleselector.h | |
parent | 32e693fe13105fab5baf81b334e932fce62d89b5 (diff) | |
download | pdfium-cddf8253692d3beaa97a502c8b60c1d18f81664a.tar.xz |
Use smart pointers for class owned pointers under xfa/fde
Use smart pointer to replace raw pointer type for class
owned member variables so that memory management will
be easier.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2208423002
Diffstat (limited to 'xfa/fde/css/fde_cssstyleselector.h')
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index 042e989242..469712fb5d 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -7,6 +7,7 @@ #ifndef XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ #define XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ +#include <memory> #include <vector> #include "core/fxcrt/include/fx_ext.h" @@ -26,8 +27,8 @@ class FDE_CSSRuleData : public CFX_Target { CFDE_CSSDeclaration* pDecl, uint32_t dwPos); - CFDE_CSSSelector* pSelector; - CFDE_CSSDeclaration* pDeclaration; + CFDE_CSSSelector* const pSelector; + CFDE_CSSDeclaration* const pDeclaration; uint32_t dwPriority; FDE_CSSRuleData* pNext; }; @@ -88,10 +89,9 @@ class CFDE_CSSRuleCollection : public CFX_Target { class CFDE_CSSStyleSelector : public CFX_Target { public: - CFDE_CSSStyleSelector(); + explicit CFDE_CSSStyleSelector(IFGAS_FontMgr* pFontMgr); ~CFDE_CSSStyleSelector() override; - void SetFontMgr(IFGAS_FontMgr* pFontMgr); void SetDefFontSize(FX_FLOAT fFontSize); FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, @@ -174,15 +174,15 @@ class CFDE_CSSStyleSelector : public CFX_Target { FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); - IFGAS_FontMgr* m_pFontMgr; + IFGAS_FontMgr* const m_pFontMgr; FX_FLOAT m_fDefFontSize; - IFX_MemoryAllocator* m_pRuleDataStore; + std::unique_ptr<IFX_MemoryAllocator> m_pRuleDataStore; CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; - IFX_MemoryAllocator* m_pInlineStyleStore; - IFX_MemoryAllocator* m_pFixedStyleStore; - CFDE_CSSAccelerator* m_pAccelerator; + std::unique_ptr<IFX_MemoryAllocator> m_pInlineStyleStore; + std::unique_ptr<IFX_MemoryAllocator> m_pFixedStyleStore; + std::unique_ptr<CFDE_CSSAccelerator> m_pAccelerator; std::vector<FDE_CSSRuleData*> m_MatchedRules; }; @@ -413,7 +413,7 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, const CFX_WideString& wsValue); uint32_t m_dwRefCount; - IFX_MemoryAllocator* m_pAllocator; + IFX_MemoryAllocator* const m_pAllocator; CFDE_CSSInheritedData m_InheritedData; CFDE_CSSNonInheritedData m_NonInheritedData; CFX_WideStringArray m_CustomProperties; |