summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-08 09:49:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-08 09:49:42 -0700
commite5aff74a43a2c3355a8b7699a47d0fb7f23b243e (patch)
treecaa9e0f3dffc91bfdf7b753171353b4ae9c5370a /fpdfsdk/javascript/app.cpp
parent660de3c494b68a574cb4cdf20359f51ddc260d3c (diff)
downloadpdfium-e5aff74a43a2c3355a8b7699a47d0fb7f23b243e.tar.xz
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
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp11
1 files changed, 5 insertions, 6 deletions
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"]";