summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_mgr.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-21 16:29:20 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-21 16:29:20 -0700
commitbca779d0957965eb2ebfad5479e0894844749626 (patch)
treec038cd9465f368563297840e8144265e909cc2ed /fpdfsdk/src/fsdk_mgr.cpp
parent270fc65d5824eeedbb2ed17516a72721bde9c9ef (diff)
downloadpdfium-bca779d0957965eb2ebfad5479e0894844749626.tar.xz
The Factory Design Pattern isn't buying us anything here over just new'ing the object we want. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1360523004 .
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 9cbb9de4d9..5b94aef600 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -10,6 +10,7 @@
#include "../include/fsdk_mgr.h"
#include "../include/formfiller/FFL_FormFiller.h"
#include "../include/javascript/IJavaScript.h"
+#include "../include/javascript/JS_Runtime.h"
#if _FX_OS_ == _FX_ANDROID_
#include "time.h"
@@ -203,31 +204,20 @@ FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() {
return m_pEnv->FFI_GetLocalTime();
}
-CJS_RuntimeFactory* GetJSRuntimeFactory() {
- static CJS_RuntimeFactory s_JSRuntimeFactory;
- return &s_JSRuntimeFactory;
-}
-
CPDFDoc_Environment::CPDFDoc_Environment(CPDF_Document* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
: m_pAnnotHandlerMgr(NULL),
m_pActionHandler(NULL),
- m_pJSRuntime(NULL),
m_pInfo(pFFinfo),
m_pSDKDoc(NULL),
m_pPDFDoc(pDoc),
m_pIFormFiller(NULL) {
m_pSysHandler = new CFX_SystemHandler(this);
- m_pJSRuntimeFactory = GetJSRuntimeFactory();
- m_pJSRuntimeFactory->AddRef();
}
CPDFDoc_Environment::~CPDFDoc_Environment() {
delete m_pIFormFiller;
m_pIFormFiller = NULL;
- if (m_pJSRuntime && m_pJSRuntimeFactory)
- m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime);
- m_pJSRuntimeFactory->Release();
delete m_pSysHandler;
m_pSysHandler = NULL;
@@ -384,8 +374,8 @@ IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() {
if (!IsJSInitiated())
return NULL;
if (!m_pJSRuntime)
- m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this);
- return m_pJSRuntime;
+ m_pJSRuntime.reset(new CJS_Runtime(this));
+ return m_pJSRuntime.get();
}
CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() {