summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp8
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp10
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp22
3 files changed, 3 insertions, 37 deletions
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
index 774ec6e4d6..dc5d0686fc 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
@@ -27,19 +27,12 @@ void CPDFXFA_App::ReleaseInstance() {
g_pApp = NULL;
}
-CJS_RuntimeFactory* g_GetJSRuntimeFactory() {
- static CJS_RuntimeFactory g_JSRuntimeFactory;
- return &g_JSRuntimeFactory;
-}
-
CPDFXFA_App::CPDFXFA_App()
: m_bInitRuntime(FALSE),
m_pXFAApp(NULL),
m_pFontMgr(NULL),
m_hJSERuntime(NULL),
m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
- m_pJSRuntimeFactory = g_GetJSRuntimeFactory();
- m_pJSRuntimeFactory->AddRef();
m_pEnvList.RemoveAll();
}
@@ -50,7 +43,6 @@ CPDFXFA_App::~CPDFXFA_App() {
delete m_pXFAApp;
m_pXFAApp = NULL;
- m_pJSRuntimeFactory->Release();
FXJSE_Runtime_Release(m_hJSERuntime);
m_hJSERuntime = NULL;
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 4a55622e57..a3e77e4514 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -13,6 +13,7 @@
#include "../include/formfiller/FFL_FormFiller.h"
#include "../include/javascript/IJavaScript.h"
#include "../include/fpdfxfa/fpdfxfa_app.h"
+#include "../include/javascript/JS_Runtime.h"
#if _FX_OS_ == _FX_ANDROID_
#include "time.h"
@@ -209,7 +210,6 @@ CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
: m_pAnnotHandlerMgr(NULL),
m_pActionHandler(NULL),
- m_pJSRuntime(NULL),
m_pInfo(pFFinfo),
m_pSDKDoc(NULL),
m_pXFADoc(pDoc),
@@ -222,9 +222,6 @@ CPDFDoc_Environment::~CPDFDoc_Environment() {
m_pIFormFiller = NULL;
CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
- if (m_pJSRuntime && pProvider->GetRuntimeFactory())
- pProvider->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRuntime);
-
if (pProvider->m_pEnvList.GetSize() == 0) {
pProvider->ReleaseRuntime();
pProvider->InitRuntime(TRUE);
@@ -386,9 +383,8 @@ IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() {
if (!IsJSInitiated())
return NULL;
if (!m_pJSRuntime)
- m_pJSRuntime =
- CPDFXFA_App::GetInstance()->GetRuntimeFactory()->NewJSRuntime(this);
- return m_pJSRuntime;
+ m_pJSRuntime.reset(new CJS_Runtime(this));
+ return m_pJSRuntime.get();
}
CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() {
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 643cefb92f..e8e48b0c07 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -29,28 +29,6 @@
#include "../../include/fpdfxfa/fpdfxfa_app.h"
#include "../../../xfa/src/fxjse/src/value.h"
-CJS_RuntimeFactory::~CJS_RuntimeFactory() {}
-
-IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environment* pApp) {
- m_bInit = true;
- return new CJS_Runtime(pApp);
-}
-void CJS_RuntimeFactory::AddRef() {
- m_nRef++;
-}
-void CJS_RuntimeFactory::Release() {
- if (m_bInit) {
- if (--m_nRef == 0) {
- FXJS_Release();
- m_bInit = FALSE;
- }
- }
-}
-
-void CJS_RuntimeFactory::DeleteJSRuntime(IFXJS_Runtime* pRuntime) {
- delete (CJS_Runtime*)pRuntime;
-}
-
/* ------------------------------ CJS_Runtime ------------------------------ */
v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(v8::Isolate* pIsolate);