From ce3a7e24f7bea4e360f552f21ff0dccdc76e1cbc Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Wed, 19 Jun 2024 15:50:15 +0800 Subject: [PATCH 1/8] add trace and log in XComponentPattern Signed-off-by: WangYing225 Change-Id: I1de6db2ccdb3ac67fbdba41262c82eb402ac9a70 --- .../pattern/xcomponent/xcomponent_event_hub.h | 3 +++ .../pattern/xcomponent/xcomponent_pattern.cpp | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h index a77cf63fb08..3ed07b7cb8c 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h @@ -43,6 +43,7 @@ public: void FireLoadEvent(const std::string& xcomponentId) const { + ACE_SCOPED_TRACE("XComponent[%s] FireLoadEvent", xcomponentId.c_str()); if (loadEvent_) { loadEvent_(xcomponentId); } @@ -91,6 +92,7 @@ public: void FireControllerCreatedEvent(const std::string& surfaceId) const { + ACE_SCOPED_TRACE("XComponent surface[%s] FireControllerCreatedEvent", surfaceId.c_str()); if (controllerCreatedEvent_) { controllerCreatedEvent_(surfaceId); } @@ -115,6 +117,7 @@ public: void FireControllerDestroyedEvent(const std::string& surfaceId) const { + ACE_SCOPED_TRACE("XComponent surface[%s] FireControllerDestroyedEvent", surfaceId.c_str()); if (controllerDestroyedEvent_) { controllerDestroyedEvent_(surfaceId); } diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index e9d874b0a42..e9167773c37 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -548,7 +548,10 @@ void XComponentPattern::OnDetachFromFrameNode(FrameNode* frameNode) NativeXComponentDestroy(); auto eventHub = frameNode->GetEventHub(); CHECK_NULL_VOID(eventHub); - eventHub->FireDestroyEvent(); + { + ACE_SCOPED_TRACE("XComponent[%s] FireDestroyEvent", id_.c_str()); + eventHub->FireDestroyEvent(); + } eventHub->FireDetachEvent(id_); eventHub->FireControllerDestroyedEvent(surfaceId_); #ifdef RENDER_EXTRACT_SUPPORTED @@ -733,6 +736,7 @@ void XComponentPattern::NativeXComponentChange(float width, float height) void XComponentPattern::NativeXComponentDestroy() { + ACE_SCOPED_TRACE("XComponent[%s] NativeXComponentDestroy", id_.c_str()); CHECK_RUN_ON(UI); CHECK_NULL_VOID(nativeXComponent_); CHECK_NULL_VOID(nativeXComponentImpl_); @@ -1038,6 +1042,9 @@ void XComponentPattern::HandleTouchEvent(const TouchEventInfo& info) touchEventPoint_.timeStamp = timeStamp; auto touchType = touchInfoList.front().GetTouchType(); touchEventPoint_.type = ConvertNativeXComponentTouchEvent(touchType); + LOGE("XComponent HandleTouchEvent x = %{public}f, y = %{public}f, id = %{public}d, type = %{public}zu, size = " + "%{public}ld", + touchEventPoint_.x, touchEventPoint_.y, touchEventPoint_.id, touchType, info.GetTouches().size()); #ifdef OHOS_PLATFORM // increase cpu frequency if (touchType == TouchType::MOVE) { @@ -1313,6 +1320,7 @@ ExternalEvent XComponentPattern::CreateExternalEvent() { return [weak = AceType::WeakClaim(this)]( const std::string& componentId, const uint32_t nodeId, const bool isDestroy) { + ACE_SCOPED_TRACE("XComponent[%s] FireSurfaceInitEvent", componentId.c_str()); auto pattern = weak.Upgrade(); CHECK_NULL_VOID(pattern); ContainerScope scope(pattern->GetHostInstanceId()); -- Gitee From 895fccdd5f350c8e45b47e332ff18aeb253f180a Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Wed, 19 Jun 2024 15:55:05 +0800 Subject: [PATCH 2/8] fix loge to logd Signed-off-by: WangYing225 Change-Id: Ie3c61b43686aefdbcfe783849bcce98334df2d64 --- .../components_ng/pattern/xcomponent/xcomponent_pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index e9167773c37..4e5295f32b9 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -1042,7 +1042,7 @@ void XComponentPattern::HandleTouchEvent(const TouchEventInfo& info) touchEventPoint_.timeStamp = timeStamp; auto touchType = touchInfoList.front().GetTouchType(); touchEventPoint_.type = ConvertNativeXComponentTouchEvent(touchType); - LOGE("XComponent HandleTouchEvent x = %{public}f, y = %{public}f, id = %{public}d, type = %{public}zu, size = " + LOGD("XComponent HandleTouchEvent x = %{public}f, y = %{public}f, id = %{public}d, type = %{public}zu, size = " "%{public}ld", touchEventPoint_.x, touchEventPoint_.y, touchEventPoint_.id, touchType, info.GetTouches().size()); #ifdef OHOS_PLATFORM -- Gitee From dc13aeb58003915b27ed9bc867395d2d3b9697e3 Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Wed, 19 Jun 2024 16:29:58 +0800 Subject: [PATCH 3/8] change places of traces Signed-off-by: WangYing225 Change-Id: I8edde4ccad7702a07b7ab276a3ce2844c331b459 --- .../pattern/xcomponent/xcomponent_event_hub.h | 3 --- .../pattern/xcomponent/xcomponent_pattern.cpp | 16 ++++++++++++---- .../pattern/xcomponent/xcomponent_pattern.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h index 3ed07b7cb8c..a77cf63fb08 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_event_hub.h @@ -43,7 +43,6 @@ public: void FireLoadEvent(const std::string& xcomponentId) const { - ACE_SCOPED_TRACE("XComponent[%s] FireLoadEvent", xcomponentId.c_str()); if (loadEvent_) { loadEvent_(xcomponentId); } @@ -92,7 +91,6 @@ public: void FireControllerCreatedEvent(const std::string& surfaceId) const { - ACE_SCOPED_TRACE("XComponent surface[%s] FireControllerCreatedEvent", surfaceId.c_str()); if (controllerCreatedEvent_) { controllerCreatedEvent_(surfaceId); } @@ -117,7 +115,6 @@ public: void FireControllerDestroyedEvent(const std::string& surfaceId) const { - ACE_SCOPED_TRACE("XComponent surface[%s] FireControllerDestroyedEvent", surfaceId.c_str()); if (controllerDestroyedEvent_) { controllerDestroyedEvent_(surfaceId); } diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index 4e5295f32b9..ee3f91b251c 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -553,7 +553,10 @@ void XComponentPattern::OnDetachFromFrameNode(FrameNode* frameNode) eventHub->FireDestroyEvent(); } eventHub->FireDetachEvent(id_); - eventHub->FireControllerDestroyedEvent(surfaceId_); + { + ACE_SCOPED_TRACE("XComponent[%s] FireControllerDestroyedEvent", id_.c_str()); + eventHub->FireControllerDestroyedEvent(surfaceId_); + } #ifdef RENDER_EXTRACT_SUPPORTED if (renderContextForSurface_) { renderContextForSurface_->RemoveSurfaceChangedCallBack(); @@ -805,8 +808,14 @@ void XComponentPattern::XComponentSizeInit() TAG_LOGI( AceLogTag::ACE_XCOMPONENT, "XComponent[%{public}s] triggers onLoad and OnSurfaceCreated callback", id_.c_str()); eventHub->FireSurfaceInitEvent(id_, host->GetId()); - eventHub->FireLoadEvent(id_); - eventHub->FireControllerCreatedEvent(surfaceId_); + { + ACE_SCOPED_TRACE("XComponent[%s] FireLoadEvent", id_.c_str()); + eventHub->FireLoadEvent(id_); + } + { + ACE_SCOPED_TRACE("XComponent[%s] FireControllerCreatedEvent", id_.c_str()); + eventHub->FireControllerCreatedEvent(surfaceId_); + } } void XComponentPattern::XComponentSizeChange(const RectF& surfaceRect, bool needFireNativeEvent) @@ -1320,7 +1329,6 @@ ExternalEvent XComponentPattern::CreateExternalEvent() { return [weak = AceType::WeakClaim(this)]( const std::string& componentId, const uint32_t nodeId, const bool isDestroy) { - ACE_SCOPED_TRACE("XComponent[%s] FireSurfaceInitEvent", componentId.c_str()); auto pattern = weak.Upgrade(); CHECK_NULL_VOID(pattern); ContainerScope scope(pattern->GetHostInstanceId()); diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h index b1f89dd0dc8..5bf1001abf2 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h @@ -121,6 +121,7 @@ public: void NativeXComponentInit() { + ACE_SCOPED_TRACE("XComponent[%s] NativeXComponentInit", id_.c_str()); CHECK_RUN_ON(UI); CHECK_NULL_VOID(nativeXComponentImpl_); CHECK_NULL_VOID(nativeXComponent_); -- Gitee From 40ccac77d3f07ddde5639a5445520c5b9549b404 Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Wed, 19 Jun 2024 16:50:42 +0800 Subject: [PATCH 4/8] add JSXComponent Create trace Signed-off-by: WangYing225 Change-Id: I58f4be97fcd3db1591e34d488c726b16430ffbf7 --- frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp b/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp index 404724f29ad..037525db577 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp @@ -171,6 +171,7 @@ void JSXComponent::JSBind(BindingTarget globalObj) void JSXComponent::Create(const JSCallbackInfo& info) { + ACE_SCOPED_TRACE("XComponent Create"); if (info.Length() < 1 || !info[0]->IsObject()) { return; } -- Gitee From c2bfea92b5f6442d8ee5a0b1d8549d895cde1c5e Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Wed, 19 Jun 2024 17:26:22 +0800 Subject: [PATCH 5/8] delete create trace and change traces Signed-off-by: WangYing225 Change-Id: I4abe9b158306079be452b230f18f56dcc3a34961 --- .../declarative_frontend/jsview/js_xcomponent.cpp | 1 - .../pattern/xcomponent/xcomponent_pattern.cpp | 10 +++++----- .../pattern/xcomponent/xcomponent_pattern.h | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp b/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp index 037525db577..404724f29ad 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_xcomponent.cpp @@ -171,7 +171,6 @@ void JSXComponent::JSBind(BindingTarget globalObj) void JSXComponent::Create(const JSCallbackInfo& info) { - ACE_SCOPED_TRACE("XComponent Create"); if (info.Length() < 1 || !info[0]->IsObject()) { return; } diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index ee3f91b251c..adb5ff50f5d 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -549,12 +549,12 @@ void XComponentPattern::OnDetachFromFrameNode(FrameNode* frameNode) auto eventHub = frameNode->GetEventHub(); CHECK_NULL_VOID(eventHub); { - ACE_SCOPED_TRACE("XComponent[%s] FireDestroyEvent", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireDestroyEvent", id_.c_str()); eventHub->FireDestroyEvent(); } eventHub->FireDetachEvent(id_); { - ACE_SCOPED_TRACE("XComponent[%s] FireControllerDestroyedEvent", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireControllerDestroyedEvent", id_.c_str()); eventHub->FireControllerDestroyedEvent(surfaceId_); } #ifdef RENDER_EXTRACT_SUPPORTED @@ -739,7 +739,7 @@ void XComponentPattern::NativeXComponentChange(float width, float height) void XComponentPattern::NativeXComponentDestroy() { - ACE_SCOPED_TRACE("XComponent[%s] NativeXComponentDestroy", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] NativeXComponentDestroy", id_.c_str()); CHECK_RUN_ON(UI); CHECK_NULL_VOID(nativeXComponent_); CHECK_NULL_VOID(nativeXComponentImpl_); @@ -809,11 +809,11 @@ void XComponentPattern::XComponentSizeInit() AceLogTag::ACE_XCOMPONENT, "XComponent[%{public}s] triggers onLoad and OnSurfaceCreated callback", id_.c_str()); eventHub->FireSurfaceInitEvent(id_, host->GetId()); { - ACE_SCOPED_TRACE("XComponent[%s] FireLoadEvent", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireLoadEvent", id_.c_str()); eventHub->FireLoadEvent(id_); } { - ACE_SCOPED_TRACE("XComponent[%s] FireControllerCreatedEvent", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireControllerCreatedEvent", id_.c_str()); eventHub->FireControllerCreatedEvent(surfaceId_); } } diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h index 5bf1001abf2..3ac9eb8ea3e 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h @@ -121,7 +121,7 @@ public: void NativeXComponentInit() { - ACE_SCOPED_TRACE("XComponent[%s] NativeXComponentInit", id_.c_str()); + ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] NativeXComponentInit", id_.c_str()); CHECK_RUN_ON(UI); CHECK_NULL_VOID(nativeXComponentImpl_); CHECK_NULL_VOID(nativeXComponent_); -- Gitee From 3f1f34d3b23a6ff8abe515b28ad78e140ce4b7c2 Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Thu, 20 Jun 2024 09:34:22 +0800 Subject: [PATCH 6/8] add static_cast Signed-off-by: WangYing225 Change-Id: I105dd11b68dbbd06c60516b87d60afef9c405dc5 --- .../components_ng/pattern/xcomponent/xcomponent_pattern.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index adb5ff50f5d..49d8733cb52 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -1052,8 +1052,9 @@ void XComponentPattern::HandleTouchEvent(const TouchEventInfo& info) auto touchType = touchInfoList.front().GetTouchType(); touchEventPoint_.type = ConvertNativeXComponentTouchEvent(touchType); LOGD("XComponent HandleTouchEvent x = %{public}f, y = %{public}f, id = %{public}d, type = %{public}zu, size = " - "%{public}ld", - touchEventPoint_.x, touchEventPoint_.y, touchEventPoint_.id, touchType, info.GetTouches().size()); + "%{public}d", + touchEventPoint_.x, touchEventPoint_.y, touchEventPoint_.id, touchType, + static_cast(info.GetTouches().size())); #ifdef OHOS_PLATFORM // increase cpu frequency if (touchType == TouchType::MOVE) { -- Gitee From ef3572990e8dd22fb87fd6c743bd603c35c2f70f Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Thu, 20 Jun 2024 09:57:43 +0800 Subject: [PATCH 7/8] delete trailing spaces Signed-off-by: WangYing225 Change-Id: I8b912b0892a1402f7f9b54ee0ccffad9d1ea18c6 --- .../components_ng/pattern/xcomponent/xcomponent_pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index 49d8733cb52..b4ff23eb245 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -551,7 +551,7 @@ void XComponentPattern::OnDetachFromFrameNode(FrameNode* frameNode) { ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireDestroyEvent", id_.c_str()); eventHub->FireDestroyEvent(); - } + } eventHub->FireDetachEvent(id_); { ACE_LAYOUT_SCOPED_TRACE("XComponent[%s] FireControllerDestroyedEvent", id_.c_str()); -- Gitee From 69de8c9aa3b18071848f362c620969f4ac133be0 Mon Sep 17 00:00:00 2001 From: WangYing225 Date: Thu, 20 Jun 2024 14:32:35 +0800 Subject: [PATCH 8/8] change %{public}d to %{public}u Signed-off-by: WangYing225 Change-Id: Id5ae69a2c4643de258e50d48f12a480d110150ed --- .../components_ng/pattern/xcomponent/xcomponent_pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp index b4ff23eb245..2f4c7c87394 100644 --- a/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp +++ b/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp @@ -1052,7 +1052,7 @@ void XComponentPattern::HandleTouchEvent(const TouchEventInfo& info) auto touchType = touchInfoList.front().GetTouchType(); touchEventPoint_.type = ConvertNativeXComponentTouchEvent(touchType); LOGD("XComponent HandleTouchEvent x = %{public}f, y = %{public}f, id = %{public}d, type = %{public}zu, size = " - "%{public}d", + "%{public}u", touchEventPoint_.x, touchEventPoint_.y, touchEventPoint_.id, touchType, static_cast(info.GetTouches().size())); #ifdef OHOS_PLATFORM -- Gitee