diff options
Diffstat (limited to 'fxjs/ijs_runtime.cpp')
-rw-r--r-- | fxjs/ijs_runtime.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/fxjs/ijs_runtime.cpp b/fxjs/ijs_runtime.cpp index 34a846e9e..030852483 100644 --- a/fxjs/ijs_runtime.cpp +++ b/fxjs/ijs_runtime.cpp @@ -1,36 +1,46 @@ -// Copyright 2018 PDFium Authors. All rights reserved. +// Copyright 2018 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "fxjs/ijs_runtime.h" #include "fxjs/cjs_runtimestub.h" -#include "third_party/base/ptr_util.h" #ifdef PDF_ENABLE_V8 +#include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fxjs/cfxjs_engine.h" #include "fxjs/cjs_runtime.h" -#endif +#ifdef PDF_ENABLE_XFA +#include "fxjs/gc/heap.h" +#endif // PDF_ENABLE_XFA +#endif // PDF_ENABLE_V8 IJS_Runtime::ScopedEventContext::ScopedEventContext(IJS_Runtime* pRuntime) : m_pRuntime(pRuntime), m_pContext(pRuntime->NewEventContext()) {} IJS_Runtime::ScopedEventContext::~ScopedEventContext() { - m_pRuntime->ReleaseEventContext(m_pContext.Release()); + m_pRuntime->ReleaseEventContext(m_pContext.ExtractAsDangling()); } // static -void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { +void IJS_Runtime::Initialize(unsigned int slot, void* isolate, void* platform) { #ifdef PDF_ENABLE_V8 FXJS_Initialize(slot, static_cast<v8::Isolate*>(isolate)); -#endif +#ifdef PDF_ENABLE_XFA + FXGC_Initialize(static_cast<v8::Platform*>(platform), + static_cast<v8::Isolate*>(isolate)); +#endif // PDF_ENABLE_XFA +#endif // PDF_ENABLE_V8 } // static void IJS_Runtime::Destroy() { #ifdef PDF_ENABLE_V8 +#ifdef PDF_ENABLE_XFA + FXGC_Release(); +#endif // PDF_ENABLE_XFA FXJS_Release(); -#endif +#endif // PDF_ENABLE_V8 } // static @@ -38,9 +48,9 @@ std::unique_ptr<IJS_Runtime> IJS_Runtime::Create( CPDFSDK_FormFillEnvironment* pFormFillEnv) { #ifdef PDF_ENABLE_V8 if (pFormFillEnv->IsJSPlatformPresent()) - return pdfium::MakeUnique<CJS_Runtime>(pFormFillEnv); + return std::make_unique<CJS_Runtime>(pFormFillEnv); #endif - return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv); + return std::make_unique<CJS_RuntimeStub>(pFormFillEnv); } IJS_Runtime::~IJS_Runtime() = default; |