From e5aff74a43a2c3355a8b7699a47d0fb7f23b243e Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 8 Aug 2016 09:49:42 -0700 Subject: Remove backpointer to runtime from CJS_Array. This is always available elsewhere, so save the bytes and ease removal of CJS_Array since it now only contains a single v8 local. Review-Url: https://codereview.chromium.org/2217253002 --- fpdfsdk/javascript/app.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/javascript/app.cpp') diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 329b625545..6738520390 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -109,7 +109,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc, CPDFDoc_Environment* pApp = pContext->GetReaderApp(); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); - CJS_Array aDocs(pRuntime); + CJS_Array aDocs; if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { CJS_Document* pJSDocument = nullptr; if (pDoc == pCurDoc) { @@ -124,7 +124,8 @@ FX_BOOL app::activeDocs(IJS_Context* cc, (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); ASSERT(pJSDocument); } - aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); + aDocs.SetElement(pRuntime->GetIsolate(), 0, + CJS_Value(pRuntime, pJSDocument)); } if (aDocs.GetLength() > 0) vp << aDocs; @@ -144,8 +145,6 @@ FX_BOOL app::calculate(IJS_Context* cc, CJS_Context* pContext = (CJS_Context*)cc; CPDFDoc_Environment* pApp = pContext->GetReaderApp(); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - CJS_Array aDocs(pRuntime); if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); } else { @@ -284,14 +283,14 @@ FX_BOOL app::alert(IJS_Context* cc, CFX_WideString swMsg; if (newParams[0].GetType() == CJS_Value::VT_object) { - CJS_Array carray(pRuntime); + CJS_Array carray; if (newParams[0].ConvertToArray(carray)) { swMsg = L"["; CJS_Value element(pRuntime); for (int i = 0; i < carray.GetLength(); ++i) { if (i) swMsg += L", "; - carray.GetElement(i, element); + carray.GetElement(pRuntime->GetIsolate(), i, element); swMsg += element.ToCFXWideString(); } swMsg += L"]"; -- cgit v1.2.3