mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
修复畅连core文件
Signed-off-by: wlh2624 <1968860844@qq.com> Change-Id: I28b9983aecae49aea6cc6fffa8297c252e0648fd
This commit is contained in:
parent
6f916ce9a5
commit
7c3dce65d7
@ -249,7 +249,9 @@ void ComponentObserver::Destroy(napi_env env)
|
||||
for (auto& drawitem : cbDrawList_) {
|
||||
napi_delete_reference(env, drawitem);
|
||||
}
|
||||
auto jsEngine = EngineHelper::GetCurrentEngineSafely();
|
||||
cbLayoutList_.clear();
|
||||
cbDrawList_.clear();
|
||||
auto jsEngine = weakEngine_.Upgrade();
|
||||
if (!jsEngine) {
|
||||
return;
|
||||
}
|
||||
@ -304,6 +306,7 @@ static napi_value JSCreateComponentObserver(napi_env env, napi_callback_info inf
|
||||
|
||||
jsEngine->RegisterLayoutInspectorCallback(observer->layoutEvent_, observer->componentId_);
|
||||
jsEngine->RegisterDrawInspectorCallback(observer->drawEvent_, observer->componentId_);
|
||||
observer->SetEngine(jsEngine);
|
||||
#if defined(PREVIEW)
|
||||
layoutCallback();
|
||||
drawCallback();
|
||||
|
@ -51,10 +51,15 @@ public:
|
||||
std::string componentId_;
|
||||
std::list<napi_ref> cbLayoutList_;
|
||||
std::list<napi_ref> cbDrawList_;
|
||||
void SetEngine(const RefPtr<Framework::JsEngine>& engine)
|
||||
{
|
||||
weakEngine_ = engine;
|
||||
}
|
||||
|
||||
private:
|
||||
void FunctionOn(napi_env& env, napi_value result, const char* funName);
|
||||
void FunctionOff(napi_env& env, napi_value result, const char* funName);
|
||||
WeakPtr<Framework::JsEngine> weakEngine_;
|
||||
};
|
||||
} // namespace OHOS::Ace::Napi
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user