From bdeeb8a036442302b821686a03698b0bb98952e1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 27 May 2015 12:25:00 -0700 Subject: Make CPDFXFA_App / IXFA_AppProvider saner Move interface comments from the implementation header to the interface header. Replace Create / Release functions with static methods. Replace dubious Release() methods with deletion via virtual dtor, also for IXFA_App and IXFA_FontMgr while we're at it. Untabify and fix (theoretically) illegal _CAP include guard definitions for fpdfxfa/ headers. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1153553003 --- xfa/src/fxfa/src/app/xfa_ffapp.cpp | 7 ++++++- xfa/src/fxfa/src/app/xfa_ffapp.h | 7 ++----- xfa/src/fxfa/src/app/xfa_fontmgr.cpp | 7 ++++++- xfa/src/fxfa/src/app/xfa_fontmgr.h | 6 +----- 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'xfa/src') diff --git a/xfa/src/fxfa/src/app/xfa_ffapp.cpp b/xfa/src/fxfa/src/app/xfa_ffapp.cpp index 67ec95b009..abd02460d1 100644 --- a/xfa/src/fxfa/src/app/xfa_ffapp.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffapp.cpp @@ -134,9 +134,14 @@ FX_BOOL CXFA_FileRead2::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) } return FALSE; } +// static IXFA_App* IXFA_App::Create(IXFA_AppProvider* pProvider) { - return FX_NEW CXFA_FFApp(pProvider); + return new CXFA_FFApp(pProvider); +} +// virtual +IXFA_App::~IXFA_App() +{ } CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pDocHandler(NULL) diff --git a/xfa/src/fxfa/src/app/xfa_ffapp.h b/xfa/src/fxfa/src/app/xfa_ffapp.h index 82d0b95e02..b99f1fe209 100644 --- a/xfa/src/fxfa/src/app/xfa_ffapp.h +++ b/xfa/src/fxfa/src/app/xfa_ffapp.h @@ -47,11 +47,8 @@ class CXFA_FFApp : public IXFA_App, public IFWL_AdapterNative { public: CXFA_FFApp(IXFA_AppProvider* pProvider); - ~CXFA_FFApp(); - virtual void Release() - { - delete this; - } + ~CXFA_FFApp() override; + virtual IXFA_DocHandler* GetDocHandler(); virtual XFA_HDOC CreateDoc(IXFA_DocProvider* pProvider, IFX_FileRead* pStream, FX_BOOL bTakeOverFile); virtual XFA_HDOC CreateDoc(IXFA_DocProvider* pProvider, CPDF_Document* pPDFDoc); diff --git a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp index ef49911dc1..8138e5870b 100644 --- a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp +++ b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp @@ -1010,10 +1010,15 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName(FX_WSTR wsFontName) return NULL; #endif } -IXFA_FontMgr* XFA_GetDefaultFontMgr() +// static +IXFA_FontMgr* IXFA_FontMgr::CreateDefault() { return FX_NEW CXFA_DefFontMgr; } +// virtual +IXFA_FontMgr::~IXFA_FontMgr() +{ +} CXFA_DefFontMgr::~CXFA_DefFontMgr() { FX_INT32 iCounts = m_CacheFonts.GetSize(); diff --git a/xfa/src/fxfa/src/app/xfa_fontmgr.h b/xfa/src/fxfa/src/app/xfa_fontmgr.h index 09e0d19096..fd65570115 100644 --- a/xfa/src/fxfa/src/app/xfa_fontmgr.h +++ b/xfa/src/fxfa/src/app/xfa_fontmgr.h @@ -17,11 +17,7 @@ class CXFA_DefFontMgr : public IXFA_FontMgr { public: CXFA_DefFontMgr() {} - virtual ~CXFA_DefFontMgr(); - virtual void Release() - { - delete this; - } + ~CXFA_DefFontMgr() override; virtual IFX_Font* GetFont(XFA_HDOC hDoc, FX_WSTR wsFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF); virtual IFX_Font* GetDefaultFont(XFA_HDOC hDoc, FX_WSTR wsFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage = 0xFFFF); protected: -- cgit v1.2.3