summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_mgr.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-27 12:25:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-27 12:25:00 -0700
commitbdeeb8a036442302b821686a03698b0bb98952e1 (patch)
tree2ef5fadc13ca977f4ed134d9e2074fade72282f9 /fpdfsdk/src/fsdk_mgr.cpp
parent599851360cf036418a13ad246bf0334f46eabacb (diff)
downloadpdfium-bdeeb8a036442302b821686a03698b0bb98952e1.tar.xz
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
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp52
1 files changed, 17 insertions, 35 deletions
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;
}