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 --- fpdfsdk/src/fsdk_mgr.cpp | 52 ++++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'fpdfsdk/src/fsdk_mgr.cpp') diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index e783532ca2..ccb1ab6e34 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -215,8 +215,6 @@ FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() return m_pEnv->FFI_GetLocalTime(); } - - CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc) : m_pAnnotHandlerMgr(NULL), m_pActionHandler(NULL), @@ -226,50 +224,34 @@ CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc) : m_pDoc(pDoc), m_pIFormFiller(NULL) { - m_pSysHandler = NULL; m_pSysHandler = new CFX_SystemHandler(this); - - //m_pJSRuntimeFactory = pDoc->GetApp()->GetRuntimeFactory(); - } CPDFDoc_Environment::~CPDFDoc_Environment() { - if ( m_pIFormFiller ) - { - delete m_pIFormFiller; - m_pIFormFiller = NULL; - } - - if (m_pJSRuntime && FPDFXFA_GetApp()->GetRuntimeFactory()) - FPDFXFA_GetApp()->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRuntime); + delete m_pIFormFiller; + m_pIFormFiller = NULL; - if (FPDFXFA_GetApp()->m_pEnvList.GetSize() == 0) - { - FPDFXFA_GetApp()->ReleaseRuntime(); - FPDFXFA_GetApp()->InitRuntime(TRUE); - } + CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); + if (m_pJSRuntime && pProvider->GetRuntimeFactory()) + pProvider->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRuntime); - if(m_pSysHandler) - { - delete m_pSysHandler; - m_pSysHandler = NULL; - } + if (pProvider->m_pEnvList.GetSize() == 0) + { + pProvider->ReleaseRuntime(); + pProvider->InitRuntime(TRUE); + } - if(m_pAnnotHandlerMgr) - { - delete m_pAnnotHandlerMgr; - m_pAnnotHandlerMgr = NULL; - } - if(m_pActionHandler) - { - delete m_pActionHandler; - m_pActionHandler = NULL; - } + delete m_pSysHandler; + m_pSysHandler = NULL; + delete m_pAnnotHandlerMgr; + m_pAnnotHandlerMgr = NULL; + delete m_pActionHandler; + m_pActionHandler = NULL; } @@ -278,7 +260,7 @@ IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() if(!IsJSInitiated()) return NULL; if(!m_pJSRuntime) - m_pJSRuntime = FPDFXFA_GetApp()->GetRuntimeFactory()->NewJSRuntime(this); + m_pJSRuntime = CPDFXFA_App::GetInstance()->GetRuntimeFactory()->NewJSRuntime(this); return m_pJSRuntime; } -- cgit v1.2.3