diff options
author | tsepez <tsepez@chromium.org> | 2016-08-15 11:40:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-15 11:40:12 -0700 |
commit | a4941914bb4411dc4e9053cb344e0349db388007 (patch) | |
tree | 5b5784812bddf80eb4a79ed2597f016f8b72d8ce /fpdfsdk/javascript/cjs_runtime.cpp | |
parent | 2ba53c176df1bc5bb963901e7cc42c6a60af24eb (diff) | |
download | pdfium-a4941914bb4411dc4e9053cb344e0349db388007.tar.xz |
Move some v8 objects from CJS back into FXJS
Create a new class to hold these, CFXJS_Engine (could have been
called Runtime, but there are too many "Runtimes" already). In a
subsequent patch, all the FXJS_*() functions that take an isolate
as the first argument can become methods on the engine.
CJS_ must still manage the isolates; this happens outside
the engine.
The IJS_Runtime abstraction moves up to fpdfsdk/javascript; it
remains to allow for either a real JS library or a stubb one to
be linked (for non-js builds).
Review-Url: https://codereview.chromium.org/2241483004
Diffstat (limited to 'fpdfsdk/javascript/cjs_runtime.cpp')
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 7eaf1451ca..36d888a2ea 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -58,8 +58,7 @@ CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) { CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_pDocument(nullptr), - m_bBlocking(FALSE), - m_isolate(nullptr), + m_bBlocking(false), m_isolateManaged(false) { #ifndef PDF_ENABLE_XFA IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform; @@ -96,7 +95,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) v8::HandleScope handle_scope(isolate); if (CPDFXFA_App::GetInstance()->IsJavaScriptInitialized()) { CJS_Context* pContext = (CJS_Context*)NewContext(); - FXJS_InitializeRuntime(GetIsolate(), this, &m_context, &m_StaticObjects); + FXJS_InitializeEngine(GetIsolate(), this, &m_context, &m_StaticObjects); ReleaseContext(pContext); return; } @@ -110,7 +109,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) #endif CJS_Context* pContext = (CJS_Context*)NewContext(); - FXJS_InitializeRuntime(GetIsolate(), this, &m_context, &m_StaticObjects); + FXJS_InitializeEngine(GetIsolate(), this, &m_context, &m_StaticObjects); ReleaseContext(pContext); } @@ -120,7 +119,7 @@ CJS_Runtime::~CJS_Runtime() { m_ContextArray.clear(); m_ConstArrays.clear(); - FXJS_ReleaseRuntime(GetIsolate(), &m_context, &m_StaticObjects); + FXJS_ReleaseEngine(GetIsolate(), &m_context, &m_StaticObjects); m_context.Reset(); if (m_isolateManaged) m_isolate->Dispose(); @@ -284,7 +283,7 @@ FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, // Do so now. // TODO(tsepez): redesign PDF-side objects to not rely on v8::Context's // embedder data slots, and/or to always use the right context. - FXJS_SetRuntimeForV8Context(old_context, this); + FXJS_SetEngineForV8Context(old_context, this); v8::Local<v8::Value> propvalue = context->Global()->Get(v8::String::NewFromUtf8( |