From 486615821300724aef55035f4f831f548fb9cab6 Mon Sep 17 00:00:00 2001 From: jinming_wang Date: Thu, 4 Feb 2016 09:41:56 +0800 Subject: Pdfium does not create isolate when it runs in chromium BUG=pdfium:373 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1652873003 . --- xfa/src/fxjse/src/runtime.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'xfa/src/fxjse') 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(pIsolate); } -void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime) { +void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime) { v8::Isolate* pIsolate = reinterpret_cast(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) { -- cgit v1.2.3