From b5b7972cdc064498b45d230225aa92fee1acc7b6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 5 Feb 2018 15:13:09 +0000 Subject: Move const arrays to CFXJS_Engine from CJS_V8 CJS_V8 is shared by both the non-xfa and xfa-side JS engines, but the const arrays are only used by the non-xfa side. Change-Id: Ic5ed8238df1a14dde8a4463b2388b4a7a923e392 Reviewed-on: https://pdfium-review.googlesource.com/25250 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fxjs/fxjs_v8.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'fxjs/fxjs_v8.cpp') diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp index c9d227cc47..f1555b2e96 100644 --- a/fxjs/fxjs_v8.cpp +++ b/fxjs/fxjs_v8.cpp @@ -436,7 +436,7 @@ void CFXJS_Engine::ReleaseEngine() { if (!pData) return; - ClearConstArray(); + m_ConstArrays.clear(); int maxID = CFXJS_ObjDefinition::MaxID(GetIsolate()); for (int i = 0; i < maxID; ++i) { @@ -561,3 +561,12 @@ void* CFXJS_Engine::GetObjectPrivate(v8::Local pObj) { } return pData ? pData->m_pPrivate : nullptr; } + +v8::Local CFXJS_Engine::GetConstArray(const WideString& name) { + return v8::Local::New(GetIsolate(), m_ConstArrays[name]); +} + +void CFXJS_Engine::SetConstArray(const WideString& name, + v8::Local array) { + m_ConstArrays[name] = v8::Global(GetIsolate(), array); +} -- cgit v1.2.3