From 5f554133283d03b6b30bcecfcdc689cccf3799ec Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 16 Feb 2016 11:34:36 -0800 Subject: IFWL_App::Create() always passed adapter, "fuel" adapter unused R=thestig@chromium.org Review URL: https://codereview.chromium.org/1707433002 . --- xfa/src/fwl/src/core/fwl_appimp.cpp | 35 ++++++++++--------------------- xfa/src/fwl/src/core/include/fwl_appimp.h | 13 ++++++------ 2 files changed, 18 insertions(+), 30 deletions(-) (limited to 'xfa/src/fwl') diff --git a/xfa/src/fwl/src/core/fwl_appimp.cpp b/xfa/src/fwl/src/core/fwl_appimp.cpp index a9d8e2834e..aced5e66c6 100644 --- a/xfa/src/fwl/src/core/fwl_appimp.cpp +++ b/xfa/src/fwl/src/core/fwl_appimp.cpp @@ -39,46 +39,33 @@ FWL_ERR IFWL_App::Exit(int32_t iExitCode) { } CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter) - : CFWL_NoteThreadImp(pIface), m_pWidgetMgr(NULL), m_pThemeProvider(NULL) { - if (!pAdapter) { - pAdapter = FWL_CreateFuelAdapterNative(); - m_bFuelAdapter = TRUE; - } else { - m_bFuelAdapter = FALSE; - } - m_pAdapterNative = pAdapter; -} + : CFWL_NoteThreadImp(pIface), + m_pAdapterNative(pAdapter), + m_pThemeProvider(nullptr) {} + CFWL_AppImp::~CFWL_AppImp() { CFWL_ToolTipContainer::DeleteInstance(); - if (m_bFuelAdapter) { - FWL_ReleaseFuelAdapterNative(m_pAdapterNative); - m_pAdapterNative = NULL; - } - if (m_pWidgetMgr) { - delete m_pWidgetMgr; - m_pWidgetMgr = NULL; - } } + FWL_ERR CFWL_AppImp::Initialize() { if (!m_pWidgetMgr) { - m_pWidgetMgr = new CFWL_WidgetMgr(m_pAdapterNative); + m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); } return FWL_ERR_Succeeded; } FWL_ERR CFWL_AppImp::Finalize() { - delete m_pWidgetMgr; - m_pWidgetMgr = NULL; + m_pWidgetMgr.reset(); return FWL_ERR_Succeeded; } -IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() { +IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const { return m_pAdapterNative; } IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { return static_cast(FWL_GetWidgetMgr()) ->GetAdapterWidgetMgr(); } -IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() { - return m_pWidgetMgr; +IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { + return m_pWidgetMgr.get(); } FWL_ERR CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pThemeProvider = pThemeProvider; @@ -89,7 +76,7 @@ FWL_ERR CFWL_AppImp::Exit(int32_t iExitCode) { ; return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0); } -IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() { +IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { return m_pThemeProvider; } IFWL_AdapterNative* FWL_GetAdapterNative() { diff --git a/xfa/src/fwl/src/core/include/fwl_appimp.h b/xfa/src/fwl/src/core/include/fwl_appimp.h index 244445dc6e..627876674f 100644 --- a/xfa/src/fwl/src/core/include/fwl_appimp.h +++ b/xfa/src/fwl/src/core/include/fwl_appimp.h @@ -7,6 +7,8 @@ #ifndef FWL_APPIMP_H_ #define FWL_APPIMP_H_ +#include + #include "xfa/src/fwl/src/core/include/fwl_threadimp.h" class CFWL_WidgetMgr; @@ -21,17 +23,16 @@ class CFWL_AppImp : public CFWL_NoteThreadImp { virtual ~CFWL_AppImp(); virtual FWL_ERR Initialize(); virtual FWL_ERR Finalize(); - virtual IFWL_AdapterNative* GetAdapterNative(); - virtual IFWL_WidgetMgr* GetWidgetMgr(); - virtual IFWL_ThemeProvider* GetThemeProvider(); + virtual IFWL_AdapterNative* GetAdapterNative() const; + virtual IFWL_WidgetMgr* GetWidgetMgr() const; + virtual IFWL_ThemeProvider* GetThemeProvider() const; virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual FWL_ERR Exit(int32_t iExitCode = 0); protected: - CFWL_WidgetMgr* m_pWidgetMgr; - IFWL_AdapterNative* m_pAdapterNative; + IFWL_AdapterNative* const m_pAdapterNative; + std::unique_ptr m_pWidgetMgr; IFWL_ThemeProvider* m_pThemeProvider; - FX_BOOL m_bFuelAdapter; }; #endif // FWL_APPIMP_H_ -- cgit v1.2.3