diff options
author | jinming_wang <jinming_wang@foxitsoftware.com> | 2016-02-04 09:41:56 +0800 |
---|---|---|
committer | jinming_wang <jinming_wang@foxitsoftware.com> | 2016-02-04 09:41:56 +0800 |
commit | 486615821300724aef55035f4f831f548fb9cab6 (patch) | |
tree | b5ccf7e0f7425a9039b6ea349a996396bad1cbf5 /xfa | |
parent | 99ddbfbcc3d0e8a52c8f8a4ec22462d9e00c1c6a (diff) | |
download | pdfium-486615821300724aef55035f4f831f548fb9cab6.tar.xz |
Pdfium does not create isolate when it runs in chromium
BUG=pdfium:373
R=jochen@chromium.org
Review URL: https://codereview.chromium.org/1652873003 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/include/fxjse/fxjse.h | 2 | ||||
-rw-r--r-- | xfa/src/fxjse/src/runtime.cpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/xfa/include/fxjse/fxjse.h b/xfa/include/fxjse/fxjse.h index bac63208f8..b8a2af4b8a 100644 --- a/xfa/include/fxjse/fxjse.h +++ b/xfa/include/fxjse/fxjse.h @@ -24,7 +24,7 @@ typedef double FXJSE_DOUBLE; void FXJSE_Initialize(); void FXJSE_Finalize(); FXJSE_HRUNTIME FXJSE_Runtime_Create(); -void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime); +void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); typedef struct _FXJSE_CLASS FXJSE_CLASS; FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, const FXJSE_CLASS* lpGlobalClass = nullptr, diff --git a/xfa/src/fxjse/src/runtime.cpp b/xfa/src/fxjse/src/runtime.cpp index 5609c35b63..72e221226d 100644 --- a/xfa/src/fxjse/src/runtime.cpp +++ b/xfa/src/fxjse/src/runtime.cpp @@ -58,12 +58,19 @@ FXJSE_HRUNTIME FXJSE_Runtime_Create() { CFXJSE_RuntimeData::g_RuntimeList->AppendRuntime(pIsolate); return reinterpret_cast<FXJSE_HRUNTIME>(pIsolate); } -void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime) { +void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime) { v8::Isolate* pIsolate = reinterpret_cast<v8::Isolate*>(hRuntime); - if (pIsolate) { + if (!pIsolate) + return; + if (bOwnedRuntime) { ASSERT(CFXJSE_RuntimeData::g_RuntimeList); CFXJSE_RuntimeData::g_RuntimeList->RemoveRuntime( pIsolate, FXJSE_Runtime_DisposeCallback); + } else { + if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) { + delete pData->m_pFXJSERuntimeData; + pData->m_pFXJSERuntimeData = nullptr; + } } } CFXJSE_RuntimeData* CFXJSE_RuntimeData::Create(v8::Isolate* pIsolate) { |