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/include/fwl/adapter/fwl_adapternative.h | 9 ++++---- xfa/src/fwl/src/core/fwl_appimp.cpp | 35 +++++++++-------------------- xfa/src/fwl/src/core/include/fwl_appimp.h | 13 ++++++----- xfa/src/fxfa/src/app/xfa_fwladapter.cpp | 5 +---- 4 files changed, 23 insertions(+), 39 deletions(-) (limited to 'xfa') diff --git a/xfa/include/fwl/adapter/fwl_adapternative.h b/xfa/include/fwl/adapter/fwl_adapternative.h index b914f7bfb2..3ea5c89270 100644 --- a/xfa/include/fwl/adapter/fwl_adapternative.h +++ b/xfa/include/fwl/adapter/fwl_adapternative.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _FWL_ADAPTER_NATIVE_H -#define _FWL_ADAPTER_NATIVE_H +#ifndef FWL_ADAPTERNATIVE_H_ +#define FWL_ADAPTERNATIVE_H_ class IFWL_WidgetMgrDelegate; class IFWL_AdapterWidgetMgr; @@ -20,6 +20,5 @@ class IFWL_AdapterNative { virtual IFWL_AdapterThreadMgr* GetThreadMgr() = 0; virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; }; -IFWL_AdapterNative* FWL_CreateFuelAdapterNative(); -void FWL_ReleaseFuelAdapterNative(IFWL_AdapterNative* pAdapterNative); -#endif + +#endif // FWL_ADAPTERNATIVE_H_ 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_ diff --git a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp index e5a3e7a2bc..517c491a0e 100644 --- a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp @@ -10,10 +10,7 @@ #include "xfa_ffwidget.h" #include "xfa_fffield.h" #include "xfa_ffdoc.h" -IFWL_AdapterNative* FWL_CreateFuelAdapterNative() { - return NULL; -} -void FWL_ReleaseFuelAdapterNative(IFWL_AdapterNative* native) {} + void FWL_PostMessageToMainRoop(CFWL_Message* pMessage) {} FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, FX_BOOL bVisible, -- cgit v1.2.3