Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
ijs_runtime.cpp
Go to the documentation of this file.
1// Copyright 2018 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "fxjs/ijs_runtime.h"
6
7#include "fxjs/cjs_runtimestub.h"
8
9#ifdef PDF_ENABLE_V8
10#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
11#include "fxjs/cfxjs_engine.h"
12#include "fxjs/cjs_runtime.h"
13#include "fxjs/global_timer.h"
14#ifdef PDF_ENABLE_XFA
15#include "fxjs/gc/heap.h"
16#endif // PDF_ENABLE_XFA
17#endif // PDF_ENABLE_V8
18
21
23 m_pRuntime->ReleaseEventContext(m_pContext.ExtractAsDangling());
24}
25
26// static
27void IJS_Runtime::Initialize(unsigned int slot, void* isolate, void* platform) {
28#ifdef PDF_ENABLE_V8
29 GlobalTimer::InitializeGlobals();
30 FXJS_Initialize(slot, static_cast<v8::Isolate*>(isolate));
31#ifdef PDF_ENABLE_XFA
32 FXGC_Initialize(static_cast<v8::Platform*>(platform),
33 static_cast<v8::Isolate*>(isolate));
34#endif // PDF_ENABLE_XFA
35#endif // PDF_ENABLE_V8
36}
37
38// static
40#ifdef PDF_ENABLE_V8
41#ifdef PDF_ENABLE_XFA
42 FXGC_Release();
43#endif // PDF_ENABLE_XFA
44 FXJS_Release();
45 GlobalTimer::DestroyGlobals();
46#endif // PDF_ENABLE_V8
47}
48
49// static
50std::unique_ptr<IJS_Runtime> IJS_Runtime::Create(
51 CPDFSDK_FormFillEnvironment* pFormFillEnv) {
52#ifdef PDF_ENABLE_V8
53 if (pFormFillEnv->IsJSPlatformPresent())
54 return std::make_unique<CJS_Runtime>(pFormFillEnv);
55#endif
56 return std::make_unique<CJS_RuntimeStub>(pFormFillEnv);
57}
58
59IJS_Runtime::~IJS_Runtime() = default;
60
62 int column,
63 const WideString& exception)
64 : line(line), column(column), exception(exception) {}
ScopedEventContext(IJS_Runtime *pRuntime)
virtual ~IJS_Runtime()
static void Initialize(unsigned int slot, void *isolate, void *platform)
static void Destroy()
JS_Error(int line, int column, const WideString &exception)