From a2d699f1462050833f959ebcf24853c2a6a10f72 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 23 May 2016 17:19:20 -0700 Subject: Rename IFX_Unknown to IFX_Retainable. Rename addRef() method to Retain() to match Release(). This CL does not convert to CFX_RetainPtrs, which will happen in a follow-on. Review-Url: https://codereview.chromium.org/2005933002 --- xfa/fde/css/fde_css.h | 4 ++-- xfa/fde/css/fde_csscache.cpp | 3 +-- xfa/fde/css/fde_cssstyleselector.h | 7 +++---- xfa/fde/css/fde_cssstylesheet.cpp | 2 +- xfa/fde/css/fde_cssstylesheet.h | 20 ++++++++++++-------- 5 files changed, 19 insertions(+), 17 deletions(-) (limited to 'xfa/fde/css') diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index b949ace778..551f8f8962 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -739,7 +739,7 @@ class IFDE_CSSFontFaceRule : public IFDE_CSSRule { virtual CFDE_CSSDeclaration* GetDeclaration() = 0; }; -class IFDE_CSSStyleSheet : public IFX_Unknown { +class IFDE_CSSStyleSheet : public IFX_Retainable { public: static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); static IFDE_CSSStyleSheet* LoadFromStream( @@ -882,7 +882,7 @@ class IFDE_CSSParagraphStyle { virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; }; -class IFDE_CSSComputedStyle : public IFX_Unknown { +class IFDE_CSSComputedStyle : public IFX_Retainable { public: virtual void Reset() = 0; virtual IFDE_CSSFontStyle* GetFontStyles() = 0; diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index 0b21dcdea3..76a893d2d1 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -13,8 +13,7 @@ FDE_CSSCacheItem::FDE_CSSCacheItem(IFDE_CSSStyleSheet* p) : pStylesheet(p), dwActivity(0) { - ASSERT(pStylesheet); - pStylesheet->AddRef(); + pStylesheet->Retain(); } FDE_CSSCacheItem::~FDE_CSSCacheItem() { diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index cb54aaed7f..7227f9aab9 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -388,11 +388,10 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc) : m_dwRefCount(1), m_pAllocator(pAlloc) {} - ~CFDE_CSSComputedStyle() {} - - // IFX_Unknown: - uint32_t AddRef() override { return ++m_dwRefCount; } + ~CFDE_CSSComputedStyle() override {} + // IFX_Retainable: + uint32_t Retain() override { return ++m_dwRefCount; } uint32_t Release() override { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount == 0) { diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 80da3b042e..5a3cc76f5b 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -106,7 +106,7 @@ void CFDE_CSSStyleSheet::Reset() { delete m_pAllocator; m_pAllocator = nullptr; } -uint32_t CFDE_CSSStyleSheet::AddRef() { +uint32_t CFDE_CSSStyleSheet::Retain() { return ++m_wRefCount; } uint32_t CFDE_CSSStyleSheet::Release() { diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index 9362fb15b4..76eddda4a3 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -98,18 +98,22 @@ class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target { class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { public: CFDE_CSSStyleSheet(uint32_t dwMediaList); - ~CFDE_CSSStyleSheet(); - virtual uint32_t AddRef(); - virtual uint32_t Release(); + ~CFDE_CSSStyleSheet() override; - virtual FX_BOOL GetUrl(CFX_WideString& szUrl) { + // IFX_Retainable: + uint32_t Retain() override; + uint32_t Release() override; + + // IFDE_CSSStyleSheet: + FX_BOOL GetUrl(CFX_WideString& szUrl) override { szUrl = m_szUrl; return szUrl.GetLength() > 0; } - virtual uint32_t GetMediaList() const { return m_dwMediaList; } - virtual uint16_t GetCodePage() const { return m_wCodePage; } - virtual int32_t CountRules() const; - virtual IFDE_CSSRule* GetRule(int32_t index); + uint32_t GetMediaList() const override { return m_dwMediaList; } + uint16_t GetCodePage() const override { return m_wCodePage; } + int32_t CountRules() const override; + IFDE_CSSRule* GetRule(int32_t index) override; + FX_BOOL LoadFromStream(const CFX_WideString& szUrl, IFX_Stream* pStream, uint16_t wCodePage); -- cgit v1.2.3