7#ifndef FXJS_CJS_OBJECT_H_
8#define FXJS_CJS_OBJECT_H_
10#include "core/fxcrt/unowned_ptr.h"
11#include "fxjs/cjs_runtime.h"
12#include "third_party/base/containers/span.h"
48 CJS_Object(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
52 return m_pV8Object.Get(GetRuntime()->GetIsolate());
54 CJS_Runtime*
GetRuntime()
const {
return m_pRuntime.Get(); }
57 v8::Global<v8::Object> m_pV8Object;
58 ObservedPtr<CJS_Runtime> m_pRuntime;
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 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)
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 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
CFX_V8ArrayBufferAllocator()
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)
CJS_Runtime * GetRuntime() const
CJS_Object(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
v8::Local< v8::Object > ToV8Object()
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)
V8TemplateMap(v8::Isolate *isolate)
void SetAndMakeWeak(v8::Local< v8::Object > handle)
void ThrowExceptionHelper(v8::Isolate *pIsolate, WideStringView str)
v8::FunctionCallback pMethodCall
v8::AccessorGetterCallback pPropGet
v8::AccessorSetterCallback pPropPut