add trace_log for IfElse and LazyForEach component

Signed-off-by: liubihao <liubihao1@huawei.com>
This commit is contained in:
liubihao 2024-06-27 15:41:02 +08:00
parent 172820bdb1
commit 197b90b32b
9 changed files with 29 additions and 8 deletions

View File

@ -118,6 +118,11 @@ bool IsTextTraceEnabled()
return (system::GetParameter("persist.ace.trace.text.enabled", "false") == "true");
}
bool IsSyntaxTraceEnabled()
{
return (system::GetParameter("persist.ace.trace.syntax.enabled", "false") == "true");
}
bool IsAccessTraceEnabled()
{
return (system::GetParameter("persist.ace.trace.access.enabled", "false") == "true");
@ -365,6 +370,7 @@ bool SystemProperties::buildTraceEnable_ = IsBuildTraceEnabled() && developerMod
bool SystemProperties::syncDebugTraceEnable_ = IsSyncDebugTraceEnabled();
bool SystemProperties::pixelRoundEnable_ = IsPixelRoundEnabled();
bool SystemProperties::textTraceEnable_ = IsTextTraceEnabled();
bool SystemProperties::syntaxTraceEnable_ = IsSyntaxTraceEnabled();
bool SystemProperties::accessTraceEnable_ = IsAccessTraceEnabled();
bool SystemProperties::accessibilityEnabled_ = IsAccessibilityEnabled();
bool SystemProperties::isRound_ = false;

View File

@ -47,6 +47,7 @@ bool SystemProperties::buildTraceEnable_ = false;
bool SystemProperties::syncDebugTraceEnable_ = false;
bool SystemProperties::pixelRoundEnable_ = true;
bool SystemProperties::textTraceEnable_ = false;
bool SystemProperties::syntaxTraceEnable_ = false;
bool SystemProperties::accessTraceEnable_ = false;
bool SystemProperties::accessibilityEnabled_ = false;
bool SystemProperties::isRound_ = false;

View File

@ -33,6 +33,8 @@
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetSvgTraceEnabled(), fmt, ##__VA_ARGS__)
#define ACE_TEXT_SCOPED_TRACE(fmt, ...) \
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetTextTraceEnabled(), fmt, ##__VA_ARGS__)
#define ACE_SYNTAX_SCOPED_TRACE(fmt, ...) \
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetSyntaxTraceEnabled(), fmt, ##__VA_ARGS__)
#define ACE_ACCESS_SCOPED_TRACE(fmt, ...) \
AceScopedTraceFlag aceScopedTraceFlag(SystemProperties::GetAccessTraceEnabled(), fmt, ##__VA_ARGS__)
#define ACE_LAYOUT_SCOPED_TRACE(fmt, ...) \

View File

@ -293,6 +293,11 @@ public:
return textTraceEnable_;
}
static bool GetSyntaxTraceEnabled()
{
return syntaxTraceEnable_;
}
static bool GetAccessTraceEnabled()
{
return accessTraceEnable_;
@ -548,6 +553,7 @@ private:
static bool syncDebugTraceEnable_;
static bool pixelRoundEnable_;
static bool textTraceEnable_;
static bool syntaxTraceEnable_;
static bool accessTraceEnable_;
static bool accessibilityEnabled_;
static uint32_t canvasDebugMode_;

View File

@ -70,6 +70,7 @@ RefPtr<IfElseNode> IfElseNode::GetOrCreateIfElseNode(int32_t nodeId)
void IfElseNode::SetBranchId(int32_t value, std::list<int32_t>& removedElmtId)
{
branchIdChanged_ = (branchId_ != value);
TAG_LOGD(AceLogTag::ACE_IF, "id: %{public}d, branchIdChanged_: %{public}d", GetId(), branchIdChanged_);
if (branchIdChanged_) {
// collect elmtIds of all children and their children up to CustomNode object
// these will be removed, but possibly with a delay if their is an animation
@ -102,6 +103,7 @@ bool IfElseNode::TryRetake(const std::string& id)
{
auto node = GetDisappearingChildById(id);
if (node) {
ACE_SCOPED_TRACE("IfElse TryRetake validate.");
AddChild(node);
// for geometryTransition, let all reused children call UpdateGeometryTransition.
LayoutProperty::UpdateAllGeometryTransition(node);

View File

@ -622,7 +622,7 @@ namespace OHOS::Ace::NG {
bool LazyForEachBuilder::PreBuild(int64_t deadline, const std::optional<LayoutConstraintF>& itemConstraint,
bool canRunLongPredictTask)
{
ACE_SCOPED_TRACE("expiringItem_ count:[%zu]", expiringItem_.size());
ACE_SYNTAX_SCOPED_TRACE("expiringItem_ count:[%zu]", expiringItem_.size());
outOfBoundaryNodes_.clear();
if (itemConstraint && !canRunLongPredictTask) {
return false;

View File

@ -149,6 +149,7 @@ public:
auto frameNode = AceType::DynamicCast<FrameNode>(node.second->GetFrameChildByIndex(0, true));
if (frameNode && !frameNode->IsActive()) {
ACE_SYNTAX_SCOPED_TRACE("LazyForEach not active index[%d]", index);
frameNode->SetJSViewActive(false, true);
expiringItem_.try_emplace(node.first, LazyForEachCacheChild(index, std::move(node.second)));
continue;
@ -192,6 +193,7 @@ public:
void RemoveAllChild()
{
ACE_SYNTAX_SCOPED_TRACE("LazyForEach RemoveAllChild");
for (auto& [index, node] : cachedItems_) {
if (!node.second) {
continue;
@ -209,6 +211,7 @@ public:
bool SetActiveChildRange(int32_t start, int32_t end)
{
ACE_SYNTAX_SCOPED_TRACE("LazyForEach active range start[%d], end[%d]", start, end);
int32_t count = GetTotalCount();
bool needBuild = false;
for (auto& [index, node] : cachedItems_) {

View File

@ -112,7 +112,7 @@ void LazyForEachNode::PostIdleTask()
void LazyForEachNode::OnDataReloaded()
{
ACE_SCOPED_TRACE("OnDataReloaded");
ACE_SCOPED_TRACE("LazyForEach OnDataReloaded");
children_.clear();
if (builder_) {
builder_->SetUseNewInterface(false);
@ -128,7 +128,7 @@ void LazyForEachNode::OnDataReloaded()
void LazyForEachNode::OnDataAdded(size_t index)
{
ACE_SCOPED_TRACE("OnDataAdded");
ACE_SCOPED_TRACE("LazyForEach OnDataAdded");
auto insertIndex = static_cast<int32_t>(index);
if (builder_) {
builder_->SetUseNewInterface(false);
@ -142,7 +142,7 @@ void LazyForEachNode::OnDataAdded(size_t index)
void LazyForEachNode::OnDataBulkAdded(size_t index, size_t count)
{
ACE_SCOPED_TRACE("OnDataBulkAdded");
ACE_SCOPED_TRACE("LazyForEach OnDataBulkAdded");
auto insertIndex = static_cast<int32_t>(index);
if (builder_) {
builder_->SetUseNewInterface(false);
@ -156,7 +156,7 @@ void LazyForEachNode::OnDataBulkAdded(size_t index, size_t count)
void LazyForEachNode::OnDataDeleted(size_t index)
{
ACE_SCOPED_TRACE("OnDataDeleted");
ACE_SCOPED_TRACE("LazyForEach OnDataDeleted");
auto deletedIndex = static_cast<int32_t>(index);
if (builder_) {
builder_->SetUseNewInterface(false);
@ -179,7 +179,7 @@ void LazyForEachNode::OnDataDeleted(size_t index)
void LazyForEachNode::OnDataBulkDeleted(size_t index, size_t count)
{
ACE_SCOPED_TRACE("OnDataBulkDeleted");
ACE_SCOPED_TRACE("LazyForEach OnDataBulkDeleted");
auto deletedIndex = static_cast<int32_t>(index);
if (builder_) {
builder_->SetUseNewInterface(false);
@ -218,7 +218,7 @@ void LazyForEachNode::OnDataChanged(size_t index)
void LazyForEachNode::OnDataBulkChanged(size_t index, size_t count)
{
ACE_SCOPED_TRACE("OnDataBulkChanged");
ACE_SCOPED_TRACE("LazyForEach OnDataBulkChanged");
auto deletedIndex = static_cast<int32_t>(index);
if (builder_) {
builder_->SetUseNewInterface(false);
@ -269,7 +269,7 @@ void LazyForEachNode::OnDataMoved(size_t from, size_t to)
void LazyForEachNode::OnDatasetChange(const std::list<V2::Operation>& DataOperations)
{
ACE_SCOPED_TRACE("OnDatasetChange");
ACE_SCOPED_TRACE("LazyForEach OnDatasetChange");
int32_t initialChangedIndex = 0;
if (builder_) {
builder_->SetUseNewInterface(true);

View File

@ -43,6 +43,7 @@ bool SystemProperties::buildTraceEnable_ = false;
bool SystemProperties::syncDebugTraceEnable_ = false;
bool SystemProperties::pixelRoundEnable_ = true;
bool SystemProperties::textTraceEnable_ = false;
bool SystemProperties::syntaxTraceEnable_ = false;
double SystemProperties::resolution_ = 0.0;
constexpr float defaultAnimationScale = 1.0f;
bool SystemProperties::extSurfaceEnabled_ = false;