Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Unified Diff: fpdfsdk/src/javascript/JS_Runtime.cpp

Issue 1761073006: Re-land "Only place primitive objects on the V8 global template."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Better solution - destroy handles before runtime. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_Runtime.cpp
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 76221db3f2084e94a8fa34c9bef283ddc1fef663..88696e5110d39ab84f6d73152e1bcd2d27d6a1ff 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -121,6 +121,7 @@ CJS_Runtime::~CJS_Runtime() {
delete m_ContextArray.GetAt(i);
m_ContextArray.RemoveAll();
+ m_ConstArrays.clear();
FXJS_ReleaseRuntime(GetIsolate(), &m_context, &m_StaticObjects);
m_pApp = NULL;
@@ -256,6 +257,15 @@ v8::Local<v8::Context> CJS_Runtime::NewJSContext() {
return v8::Local<v8::Context>::New(m_isolate, m_context);
}
+void CJS_Runtime::SetConstArray(const CFX_WideString& name,
+ v8::Local<v8::Array> array) {
+ m_ConstArrays[name] = v8::Global<v8::Array>(m_isolate, array);
+}
+
+v8::Local<v8::Array> CJS_Runtime::GetConstArray(const CFX_WideString& name) {
+ return v8::Local<v8::Array>::New(m_isolate, m_ConstArrays[name]);
+}
+
#ifdef PDF_ENABLE_XFA
CFX_WideString ChangeObjName(const CFX_WideString& str) {
CFX_WideString sRet = str;
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698