本文整理汇总了C++中CFXJS_ObjDefinition::m_pDestructor方法的典型用法代码示例。如果您正苦于以下问题:C++ CFXJS_ObjDefinition::m_pDestructor方法的具体用法?C++ CFXJS_ObjDefinition::m_pDestructor怎么用?C++ CFXJS_ObjDefinition::m_pDestructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFXJS_ObjDefinition
的用法示例。
在下文中一共展示了CFXJS_ObjDefinition::m_pDestructor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FXJS_ReleaseRuntime
void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
v8::Global<v8::Context>& v8PersistentContext) {
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(pIsolate, v8PersistentContext);
v8::Context::Scope context_scope(context);
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
if (!pData)
return;
int maxID = CFXJS_ObjDefinition::MaxID(pIsolate);
for (int i = 0; i < maxID; ++i) {
CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i);
if (!pObjDef->m_StaticObj.IsEmpty()) {
v8::Local<v8::Object> pObj =
v8::Local<v8::Object>::New(pIsolate, pObjDef->m_StaticObj);
if (pObjDef->m_pDestructor)
pObjDef->m_pDestructor(pObj);
FXJS_FreePrivate(pObj);
}
delete pObjDef;
}
pIsolate->SetData(g_embedderDataSlot, nullptr);
delete pData;
}
示例2:
void V8TemplateMapTraits::Dispose(v8::Isolate* isolate,
v8::Global<v8::Object> value,
void* key) {
v8::Local<v8::Object> obj = value.Get(isolate);
if (obj.IsEmpty())
return;
CFXJS_Engine* pEngine = CFXJS_Engine::CurrentEngineFromIsolate(isolate);
int id = pEngine->GetObjDefnID(obj);
if (id == -1)
return;
CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(isolate, id);
if (!pObjDef)
return;
if (pObjDef->m_pDestructor)
pObjDef->m_pDestructor(pEngine, obj);
CFXJS_Engine::FreeObjectPrivate(obj);
}
示例3: FXJS_ReleaseRuntime
void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
v8::Global<v8::Context>* pV8PersistentContext,
std::vector<v8::Global<v8::Object>*>* pStaticObjects) {
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(pIsolate, *pV8PersistentContext);
v8::Context::Scope context_scope(context);
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
if (!pData)
return;
int maxID = CFXJS_ObjDefinition::MaxID(pIsolate);
for (int i = 0; i < maxID; ++i) {
CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i);
v8::Local<v8::Object> pObj;
if (pObjDef->m_ObjType == FXJSOBJTYPE_GLOBAL) {
pObj =
context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
} else if (pStaticObjects->at(i) && !pStaticObjects->at(i)->IsEmpty()) {
pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i));
delete pStaticObjects->at(i);
pStaticObjects->at(i) = nullptr;
}
if (!pObj.IsEmpty()) {
if (pObjDef->m_pDestructor)
pObjDef->m_pDestructor(pObj);
FXJS_FreePrivate(pObj);
}
}
if (pIsolate == g_isolate && --g_isolate_ref_count > 0)
return;
for (int i = 0; i < maxID; ++i)
delete CFXJS_ObjDefinition::ForID(pIsolate, i);
pIsolate->SetData(g_embedderDataSlot, nullptr);
delete pData;
}
示例4: ReleaseEngine
void CFXJS_Engine::ReleaseEngine() {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(m_isolate, m_V8PersistentContext);
v8::Context::Scope context_scope(context);
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(m_isolate);
if (!pData)
return;
m_ConstArrays.clear();
int maxID = CFXJS_ObjDefinition::MaxID(m_isolate);
for (int i = 0; i < maxID; ++i) {
CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(m_isolate, i);
v8::Local<v8::Object> pObj;
if (pObjDef->m_ObjType == FXJSOBJTYPE_GLOBAL) {
pObj =
context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
} else if (m_StaticObjects[i] && !m_StaticObjects[i]->IsEmpty()) {
pObj = v8::Local<v8::Object>::New(m_isolate, *m_StaticObjects[i]);
delete m_StaticObjects[i];
m_StaticObjects[i] = nullptr;
}
if (!pObj.IsEmpty()) {
if (pObjDef->m_pDestructor)
pObjDef->m_pDestructor(this, pObj);
FreeObjectPrivate(pObj);
}
}
m_V8PersistentContext.Reset();
if (m_isolate == g_isolate && --g_isolate_ref_count > 0)
return;
delete pData;
m_isolate->SetData(g_embedderDataSlot, nullptr);
}