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

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

Issue 1367033002: Pass v8::Isolate to PDFium at init time. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: kill include Created 5 years, 2 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/fpdfview.cpp ('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 1e1486df5c796f6578c07eb71e942b2747c9d32f..5c463ce498803081c76c4debacf635f775db6cc4 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -35,22 +35,17 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
m_bBlocking(FALSE),
m_isolate(NULL),
m_isolateManaged(false) {
- unsigned int embedderDataSlot = 0;
- if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
- m_isolate = reinterpret_cast<v8::Isolate*>(
- m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate);
- embedderDataSlot = pApp->GetFormFillInfo()->m_pJsPlatform->m_v8EmbedderSlot;
- }
- if (!m_isolate) {
- m_pArrayBufferAllocator.reset(new FXJS_ArrayBufferAllocator());
-
- v8::Isolate::CreateParams params;
- params.array_buffer_allocator = m_pArrayBufferAllocator.get();
- m_isolate = v8::Isolate::New(params);
- m_isolateManaged = true;
+ IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform;
+ if (pPlatform->version <= 2) {
+ unsigned int embedderDataSlot = 0;
+ v8::Isolate* pExternalIsolate = nullptr;
+ if (pPlatform->version == 2) {
+ pExternalIsolate = reinterpret_cast<v8::Isolate*>(pPlatform->m_isolate);
+ embedderDataSlot = pPlatform->m_v8EmbedderSlot;
+ }
+ FXJS_Initialize(embedderDataSlot, pExternalIsolate);
}
-
- FXJS_Initialize(embedderDataSlot);
+ m_isolateManaged = FXJS_GetIsolate(&m_isolate);
DefineJSObjects();
CJS_Context* pContext = (CJS_Context*)NewContext();
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698