From 0aae2a773cf51632b7808ab0e5b5c1635cf6a5fa Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 18 May 2016 14:01:15 -0700 Subject: Remove Release() from CXFA_FWLTheme Cleanup virtual overrides along the way. Add final to other class deriving from pure virtual interface. Review-Url: https://codereview.chromium.org/1988373002 --- xfa/fwl/lightwidget/cfwl_theme.h | 2 +- xfa/fxfa/app/xfa_ffapp.cpp | 4 +-- xfa/fxfa/app/xfa_fwltheme.h | 59 ++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h index 1de1fb607c..effb31b04e 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ b/xfa/fwl/lightwidget/cfwl_theme.h @@ -20,7 +20,7 @@ class IFWL_Widget; class CFWL_ThemePart; class CFWL_ThemeText; -class CFWL_Theme : public IFWL_ThemeProvider { +class CFWL_Theme final : public IFWL_ThemeProvider { public: CFWL_Theme(); ~CFWL_Theme() override; diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 7f19b26440..2dcb7a4e81 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -79,6 +79,7 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) m_pFWLApp->Initialize(); CXFA_TimeZoneProvider::Create(); } + CXFA_FFApp::~CXFA_FFApp() { delete m_pDocHandler; if (m_pFWLApp) { @@ -86,8 +87,7 @@ CXFA_FFApp::~CXFA_FFApp() { m_pFWLApp->Release(); delete m_pFWLApp; } - if (m_pFWLTheme) - m_pFWLTheme->Release(); + delete m_pFWLTheme; delete m_pAdapterWidgetMgr; CXFA_TimeZoneProvider::Destroy(); diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 319df8dfa5..1f75e90437 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -24,47 +24,46 @@ #include "xfa/fwl/theme/cfwl_widgettp.h" #include "xfa/fxfa/include/xfa_ffapp.h" -class CXFA_FWLTheme : public IFWL_ThemeProvider { +class CXFA_FWLTheme final : public IFWL_ThemeProvider { public: CXFA_FWLTheme(CXFA_FFApp* pApp); - virtual ~CXFA_FWLTheme(); - virtual FWL_Error Release() { - delete this; - return FWL_Error::Succeeded; - } - virtual IFWL_Widget* Retain() { return NULL; } - virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + ~CXFA_FWLTheme() override; + + FWL_Error GetClassName(CFX_WideString& wsClass) const { return FWL_Error::Succeeded; } - virtual uint32_t GetHashCode() const { return 0; } - virtual FWL_Error Initialize(); - virtual FWL_Error Finalize(); - virtual bool IsValidWidget(IFWL_Widget* pWidget); - virtual uint32_t GetThemeID(IFWL_Widget* pWidget); - virtual uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); - virtual void* GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity); - virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); - virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart); - virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy); + uint32_t GetHashCode() const { return 0; } + FWL_Error Initialize(); + FWL_Error Finalize(); - virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); - virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { + // IFWL_ThemeProvider: + bool IsValidWidget(IFWL_Widget* pWidget) override; + uint32_t GetThemeID(IFWL_Widget* pWidget) override; + uint32_t SetThemeID(IFWL_Widget* pWidget, + uint32_t dwThemeID, + FX_BOOL bChildren = TRUE) override; + FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override { return FWL_Error::Succeeded; } - virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { + FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) override { return FWL_Error::Succeeded; } - virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; + FX_BOOL DrawText(CFWL_ThemeText* pParams) override; + void* GetCapacity(CFWL_ThemePart* pThemePart, + CFWL_WidgetCapacity dwCapacity) override; + FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; + FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) override { return FWL_Error::Succeeded; } + FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, + FX_FLOAT fx, + FX_FLOAT fy) override; + FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override; + + FWL_Error GetPartRect(CFWL_ThemePart* pThemePart); protected: CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget); -- cgit v1.2.3