mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!38158 组件截图:修复delegate为空应用无法捕获异常直接crash的问题,增加get接口维测日志
Merge pull request !38158 from 胡清云/componentSnapshot_0718
This commit is contained in:
commit
17417235fa
@ -150,29 +150,18 @@ void ComponentSnapshot::Get(const std::string& componentId, JsCallback&& callbac
|
||||
return;
|
||||
}
|
||||
|
||||
auto rsNode = GetRsNode(node);
|
||||
|
||||
if (node->GetIsLayoutNode()) {
|
||||
std::list<RefPtr<FrameNode>> children;
|
||||
node->GetOneDepthVisibleFrame(children);
|
||||
if (children.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto rsNode = GetRsNode(children.front());
|
||||
if (!rsNode) {
|
||||
callback(nullptr, ERROR_CODE_INTERNAL_ERROR, nullptr);
|
||||
TAG_LOGW(AceLogTag::ACE_COMPONENT_SNAPSHOT,
|
||||
"RsNode is null from FrameNode(id=%{public}s)",
|
||||
componentId.c_str());
|
||||
return;
|
||||
}
|
||||
auto& rsInterface = Rosen::RSInterfaces::GetInstance();
|
||||
rsInterface.TakeSurfaceCaptureForUI(
|
||||
rsNode, std::make_shared<CustomizedCallback>(std::move(callback), nullptr),
|
||||
options.scale, options.scale, options.waitUntilRenderFinished);
|
||||
return;
|
||||
node = children.front();
|
||||
rsNode = GetRsNode(children.front());
|
||||
}
|
||||
|
||||
auto rsNode = GetRsNode(node);
|
||||
if (!rsNode) {
|
||||
callback(nullptr, ERROR_CODE_INTERNAL_ERROR, nullptr);
|
||||
TAG_LOGW(AceLogTag::ACE_COMPONENT_SNAPSHOT,
|
||||
@ -180,6 +169,9 @@ void ComponentSnapshot::Get(const std::string& componentId, JsCallback&& callbac
|
||||
componentId.c_str());
|
||||
return;
|
||||
}
|
||||
TAG_LOGI(AceLogTag::ACE_COMPONENT_SNAPSHOT,
|
||||
"Get ComponentSnapshot key=%{public}s Id=%{public}d Tag=%{public}s RsNodeId=%{public}" PRIu64 "",
|
||||
componentId.c_str(), node->GetId(), node->GetTag().c_str(), rsNode->GetId());
|
||||
auto& rsInterface = Rosen::RSInterfaces::GetInstance();
|
||||
rsInterface.TakeSurfaceCaptureForUI(rsNode, std::make_shared<CustomizedCallback>(std::move(callback), nullptr),
|
||||
options.scale, options.scale, options.waitUntilRenderFinished);
|
||||
|
@ -303,8 +303,8 @@ static napi_value JSSnapshotGet(napi_env env, napi_callback_info info)
|
||||
TAG_LOGW(AceLogTag::ACE_COMPONENT_SNAPSHOT,
|
||||
"Can'nt get delegate of ace_engine. param: %{public}s",
|
||||
componentId.c_str());
|
||||
NapiThrow(env, "ace engine delegate is null", ERROR_CODE_INTERNAL_ERROR);
|
||||
napi_close_escapable_handle_scope(env, scope);
|
||||
auto callback = helper.CreateCallback(&result);
|
||||
callback(nullptr, ERROR_CODE_INTERNAL_ERROR, nullptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user