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

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

Issue 1263963002: Merge to XFA: Plumb in an externally created v8::Isolate (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 5 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/include/jsapi/fxjs_v8.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 346b642913de52b5c6e432a0bd5b28d08d06865e..d68b26859103eee80edd621e855a44368594b70f 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -37,7 +37,11 @@ IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environ
{
if (!m_bInit)
{
- JS_Initial();
+ unsigned int embedderDataSlot = 0;
+ if (pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
+ embedderDataSlot = pApp->GetFormFillInfo()->m_pJsPlatform->m_v8EmbedderSlot;
+ }
+ JS_Initial(embedderDataSlot);
m_bInit = TRUE;
}
return new CJS_Runtime(pApp);
@@ -107,16 +111,22 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) :
m_pApp(pApp),
m_pDocument(NULL),
m_bBlocking(FALSE),
- m_pFieldEventPath(NULL)
+ m_pFieldEventPath(NULL),
+ m_isolate(NULL)
{
if (CPDFXFA_App::GetInstance()->GetJSERuntime()) {
+ // TODO(tsepez): CPDFXFA_App should also use the embedder provided isolate.
m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERuntime();
- } else {
+ } else if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
+ m_isolate = reinterpret_cast<v8::Isolate*>(m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate);
+ }
+ if (!m_isolate) {
m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator());
+
v8::Isolate::CreateParams params;
params.array_buffer_allocator = m_pArrayBufferAllocator.get();
m_isolate = v8::Isolate::New(params);
- }
+ }
v8::Isolate* isolate = m_isolate;
v8::Isolate::Scope isolate_scope(isolate);
« no previous file with comments | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698