add animator log

Signed-off-by: hehongyang9 <hehongyang@huawei.com>
Change-Id: I01e50ea583c5bd190b1f39b02ebc55f85d0c59a6
This commit is contained in:
hehongyang9 2024-06-11 20:25:38 +08:00
parent 91f642ae59
commit 784e47df86
2 changed files with 8 additions and 0 deletions

View File

@ -101,6 +101,8 @@ bool Animator::AttachSchedulerOnContainer()
{
auto pipeline = PipelineBase::GetCurrentContextSafely();
CHECK_NULL_RETURN(pipeline, false);
TAG_LOGI(AceLogTag::ACE_ANIMATION, "animator binds to context %{public}d, id:%{public}d", pipeline->GetInstanceId(),
GetId());
AttachScheduler(pipeline);
return true;
}
@ -510,6 +512,7 @@ void Animator::Stop()
}
status_ = Status::STOPPED;
asyncTrace_ = nullptr;
TAG_LOGI(AceLogTag::ACE_ANIMATION, "animator stop, id:%{public}d", GetId());
StatusListenable::NotifyStopListener();
for (auto& controller : proxyControllers_) {
controller->Stop();

View File

@ -609,10 +609,13 @@ static napi_value SetOnfinish(napi_env env, napi_callback_info info)
napi_create_reference(env, onfinish, 1, &onfinishRef);
animatorResult->SetOnfinishRef(onfinishRef);
animator->ClearStopListeners();
TAG_LOGI(AceLogTag::ACE_ANIMATION, "ohos.animator set finish callback, id:%{public}d", animator->GetId());
animator->AddStopListener([env, onfinishRef, id = animator->GetId()] {
napi_handle_scope scope = nullptr;
napi_open_handle_scope(env, &scope);
if (scope == nullptr) {
TAG_LOGI(AceLogTag::ACE_ANIMATION,
"ohos.animator call finish callback failed, scope is null, id:%{public}d", id);
return;
}
napi_value ret = nullptr;
@ -620,6 +623,8 @@ static napi_value SetOnfinish(napi_env env, napi_callback_info info)
auto result = napi_get_reference_value(env, onfinishRef, &onfinish);
if (result != napi_ok || onfinish == nullptr) {
napi_close_handle_scope(env, scope);
TAG_LOGI(AceLogTag::ACE_ANIMATION,
"ohos.animator call finish callback failed, get onFinish failed, id:%{public}d", id);
return;
}
TAG_LOGI(AceLogTag::ACE_ANIMATION, "ohos.animator call finish callback, id:%{public}d", id);