Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: fpdfsdk/src/fsdk_mgr.cpp

Issue 1360523004: Remove CJS_RuntimeFactory (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fsdk_mgr.cpp
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 9cbb9de4d9a4ace17ddfb5e7fb80fefcd04ab003..a713c8abad979f417f698af53f81a98d953c8f96 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,11 +204,6 @@ 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),
@@ -218,17 +214,13 @@ CPDFDoc_Environment::CPDFDoc_Environment(CPDF_Document* pDoc,
m_pPDFDoc(pDoc),
m_pIFormFiller(NULL) {
m_pSysHandler = new CFX_SystemHandler(this);
- m_pJSRuntimeFactory = GetJSRuntimeFactory();
- m_pJSRuntimeFactory->AddRef();
Tom Sepez 2015/09/21 22:12:16 Yep, we're ref-counting a static object here :).
}
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_pJSRuntime;
Lei Zhang 2015/09/21 23:16:05 Can we convert |m_pJSRuntime| to a unique_ptr whil
Tom Sepez 2015/09/21 23:28:52 Done.
delete m_pSysHandler;
m_pSysHandler = NULL;
@@ -384,7 +376,7 @@ IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() {
if (!IsJSInitiated())
return NULL;
if (!m_pJSRuntime)
- m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this);
+ m_pJSRuntime = new CJS_Runtime(this);
return m_pJSRuntime;
}
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698