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
cfxjse_runtimedata.h
Go to the documentation of this file.
1// Copyright 2016 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// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
8#define FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
9
10#include <memory>
11
12#include "fxjs/cfxjs_engine.h"
13#include "v8/include/v8-forward.h"
14#include "v8/include/v8-persistent-handle.h"
15
16class CFXJSE_RuntimeData final : public FXJS_PerIsolateData::ExtensionIface {
17 public:
18 static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);
19
20 CFXJSE_RuntimeData(const CFXJSE_RuntimeData&) = delete;
21 CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&) = delete;
22 ~CFXJSE_RuntimeData() override;
23
24 v8::Local<v8::Context> GetRootContext(v8::Isolate* pIsolate);
25
26 private:
27 static std::unique_ptr<CFXJSE_RuntimeData> Create(v8::Isolate* pIsolate);
28
29 CFXJSE_RuntimeData();
30
31 v8::Global<v8::FunctionTemplate> root_context_global_template_;
32 v8::Global<v8::Context> root_context_;
33};
34
35#endif // FXJS_XFA_CFXJSE_RUNTIMEDATA_H_
bool FXJS_GetIsolate(v8::Isolate **pResultIsolate)
size_t FXJS_GlobalIsolateRefCount()
void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate *pIsolate)
static v8::Local< v8::ObjectTemplate > GetGlobalObjectTemplate(v8::Isolate *pIsolate)
void FXJS_Release()
FXJSOBJTYPE
@ FXJSOBJTYPE_DYNAMIC
@ FXJSOBJTYPE_STATIC
@ FXJSOBJTYPE_GLOBAL
CFXJSE_RuntimeData & operator=(const CFXJSE_RuntimeData &)=delete
v8::Local< v8::Context > GetRootContext(v8::Isolate *pIsolate)
CFXJSE_RuntimeData(const CFXJSE_RuntimeData &)=delete
~CFXJSE_RuntimeData() override
static CFXJSE_RuntimeData * Get(v8::Isolate *pIsolate)
void DefineObjMethod(uint32_t nObjDefnID, const char *sMethodName, v8::FunctionCallback pMethodCall)
void DefineObjProperty(uint32_t nObjDefnID, const char *sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut)
v8::Local< v8::Context > GetV8Context()
void DefineObjConst(uint32_t nObjDefnID, const char *sConstName, v8::Local< v8::Value > pDefault)
~CFXJS_Engine() override
v8::Local< v8::Object > GetThisObj()
void DefineObjAllProperties(uint32_t nObjDefnID, v8::GenericNamedPropertyQueryCallback pPropQurey, v8::GenericNamedPropertyGetterCallback pPropGet, v8::GenericNamedPropertySetterCallback pPropPut, v8::GenericNamedPropertyDeleterCallback pPropDel, v8::GenericNamedPropertyEnumeratorCallback pPropEnum)
absl::optional< IJS_Runtime::JS_Error > Execute(const WideString &script)
void SetConstArray(const WideString &name, v8::Local< v8::Array > array)
v8::Local< v8::Array > GetConstArray(const WideString &name)
uint32_t DefineObj(const char *sObjName, FXJSOBJTYPE eObjType, Constructor pConstructor, Destructor pDestructor)
CFXJS_Engine(v8::Isolate *pIsolate)
void Error(const WideString &message)
v8::Local< v8::Object > NewFXJSBoundObject(uint32_t nObjDefnID, FXJSOBJTYPE type)
void InitializeEngine()
void DefineGlobalConst(const wchar_t *sConstName, v8::FunctionCallback pConstGetter)
void DefineGlobalMethod(const char *sMethodName, v8::FunctionCallback pMethodCall)
void RunConstructor(CFXJS_Engine *pEngine, v8::Local< v8::Object > obj, v8::Local< v8::Object > proxy)
const char * GetObjName() const
void DefineAllProperties(v8::GenericNamedPropertyQueryCallback pPropQurey, v8::GenericNamedPropertyGetterCallback pPropGet, v8::GenericNamedPropertySetterCallback pPropPut, v8::GenericNamedPropertyDeleterCallback pPropDel, v8::GenericNamedPropertyEnumeratorCallback pPropEnum)
void DefineConst(const char *sConstName, v8::Local< v8::Value > pDefault)
static void CallHandler(const v8::FunctionCallbackInfo< v8::Value > &info)
v8::Isolate * GetIsolate() const
void DefineMethod(v8::Local< v8::String > sMethodName, v8::FunctionCallback pMethodCall)
void RunDestructor(v8::Local< v8::Object > obj)
CFXJS_ObjDefinition(v8::Isolate *isolate, const char *sObjName, FXJSOBJTYPE eObjType, CFXJS_Engine::Constructor pConstructor, CFXJS_Engine::Destructor pDestructor)
FXJSOBJTYPE GetObjType() const
v8::Local< v8::ObjectTemplate > GetInstanceTemplate()
void DefineProperty(v8::Local< v8::String > sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut)
v8::Local< v8::Signature > GetSignature()
void SetPrivate(std::unique_ptr< CJS_Object > p)
~CFXJS_PerObjectData()=default
static void SetNewDataInObject(uint32_t nObjDefnID, v8::Local< v8::Object > pObj)
CJS_Object * GetPrivate()
static CFXJS_PerObjectData * GetFromObject(v8::Local< v8::Object > pObj)
uint32_t GetObjDefnID() const
static void DefineProps(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSPropertySpec > consts)
static void DefineConsts(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSConstSpec > consts)
virtual ~CJS_Object()
CJS_Runtime * GetRuntime() const
Definition cjs_object.h:54
CJS_Object(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
v8::Local< v8::Object > ToV8Object()
Definition cjs_object.h:51
static void DefineMethods(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSMethodSpec > consts)
uint32_t CurrentMaxObjDefinitionID() const
CFXJS_ObjDefinition * ObjDefinitionForID(uint32_t id) const
uint32_t AssignIDForObjDefinition(std::unique_ptr< CFXJS_ObjDefinition > pDefn)
static void OnWeakCallback(const v8::WeakCallbackInfo< WeakCallbackDataType > &data)
static void DisposeCallbackData(WeakCallbackDataType *callbackData)
static void Dispose(v8::Isolate *isolate, v8::Global< v8::Object > value, WeakCallbackDataType *key)
static WeakCallbackDataType * KeyFromWeakCallbackInfo(const v8::WeakCallbackInfo< WeakCallbackDataType > &data)
static MapType * MapFromWeakCallbackInfo(const v8::WeakCallbackInfo< WeakCallbackDataType > &)
static WeakCallbackDataType * WeakCallbackParameter(MapType *map, WeakCallbackDataType *key, v8::Local< v8::Object > value)
static const v8::PersistentContainerCallbackType kCallbackType
static void DisposeWeak(const v8::WeakCallbackInfo< WeakCallbackDataType > &data)
MapType * GetMap()
~V8TemplateMap()=default
V8TemplateMap(v8::Isolate *isolate)
void SetAndMakeWeak(v8::Local< v8::Object > handle)
Definition fxv8.h:22
void ThrowExceptionHelper(v8::Isolate *pIsolate, WideStringView str)
Definition fxv8.cpp:333
#define CHECK(cvref)
const char * pName
Definition cjs_object.h:19
double number
Definition cjs_object.h:21
const char * pStr
Definition cjs_object.h:22
v8::FunctionCallback pMethodCall
Definition cjs_object.h:33
const char * pName
Definition cjs_object.h:32
v8::AccessorGetterCallback pPropGet
Definition cjs_object.h:27
const char * pName
Definition cjs_object.h:26
v8::AccessorSetterCallback pPropPut
Definition cjs_object.h:28