summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-06-01 14:01:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-01 14:01:31 -0700
commitd5f726188761cd00cb3d16921093a859bda39a71 (patch)
tree53b0ae177f9f1d08a627ac3517356f5e62345beb /fpdfsdk
parentc3246466df915a5b8a639dd3a611d18cd106773b (diff)
downloadpdfium-d5f726188761cd00cb3d16921093a859bda39a71.tar.xz
Track shared isolates better in FXJSE.
Fix the asymmetry between creating only some isolates and releasing all of them, even the shared ones, by being more careful not to trash those we didn't create. Review-Url: https://codereview.chromium.org/2025193002
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_app.cpp13
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_app.h1
2 files changed, 4 insertions, 10 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
index f7a6a3ba00..56dfd47b29 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
@@ -32,8 +32,7 @@ CPDFXFA_App::CPDFXFA_App()
: m_bJavaScriptInitialized(FALSE),
m_pXFAApp(NULL),
m_pIsolate(nullptr),
- m_csAppType(JS_STR_VIEWERTYPE_STANDARD),
- m_bOwnedRuntime(false) {
+ m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
m_pEnvList.RemoveAll();
}
@@ -41,29 +40,25 @@ CPDFXFA_App::~CPDFXFA_App() {
delete m_pXFAApp;
m_pXFAApp = NULL;
-#ifdef PDF_ENABLE_XFA
- FXJSE_Runtime_Release(m_pIsolate, m_bOwnedRuntime);
+ FXJSE_Runtime_Release(m_pIsolate);
m_pIsolate = nullptr;
FXJSE_Finalize();
BC_Library_Destory();
-#endif
}
FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) {
-#ifdef PDF_ENABLE_XFA
BC_Library_Init();
FXJSE_Initialize();
- m_bOwnedRuntime = !pIsolate;
- m_pIsolate = pIsolate ? pIsolate : FXJSE_Runtime_Create();
+ m_pIsolate = pIsolate ? pIsolate : FXJSE_Runtime_Create_Own();
if (!m_pIsolate)
return FALSE;
m_pXFAApp = new CXFA_FFApp(this);
m_pXFAApp->SetDefaultFontMgr(
std::unique_ptr<CXFA_DefFontMgr>(new CXFA_DefFontMgr));
-#endif
+
return TRUE;
}
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
index b561245dcd..f24c700434 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h
@@ -87,7 +87,6 @@ class CPDFXFA_App : public IXFA_AppProvider {
v8::Isolate* m_pIsolate;
IFXJS_Runtime* m_pJSRuntime;
CFX_WideString m_csAppType;
- bool m_bOwnedRuntime;
};
#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_