diff --git a/packages/react-native/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp b/packages/react-native/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp index dce8171ea9c..672802ed7aa 100644 --- a/packages/react-native/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp +++ b/packages/react-native/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp @@ -7,6 +7,7 @@ #include "ViewTransitionModule.h" +#include #include #include #include @@ -72,6 +73,7 @@ void ViewTransitionModule::applyViewTransitionName( const ShadowNode& shadowNode, const std::string& name, const std::string& /*className*/) { + TraceSection s("ViewTransitionModule::applyViewTransitionName", "name", name); auto tag = shadowNode.getTag(); auto surfaceId = shadowNode.getSurfaceId(); @@ -109,6 +111,10 @@ void ViewTransitionModule::applyViewTransitionName( if (uiManager_ != nullptr) { auto* delegate = uiManager_->getDelegate(); if (delegate != nullptr) { + TraceSection snapshotSection( + "ViewTransitionModule::applyViewTransitionName - uiManagerDidCaptureViewSnapshot", + "name", + name); delegate->uiManagerDidCaptureViewSnapshot(tag, surfaceId); } } @@ -119,6 +125,11 @@ void ViewTransitionModule::applyViewTransitionName( auto& pseudoElementsBySourceTag = it->second; auto innerIt = pseudoElementsBySourceTag.find(tag); + TraceSection clonePseudoElementSection( + "ViewTransitionModule::applyViewTransitionName - maybeClonePseudoElement", + "name", + name); + if (innerIt != pseudoElementsBySourceTag.end()) { // Only clone the pseudo-element if the layout metrics changed // since it was last created/refreshed (e.g. due to scrolling or @@ -166,6 +177,8 @@ void ViewTransitionModule::applyViewTransitionName( void ViewTransitionModule::createViewTransitionInstance( const std::string& name, Tag pseudoElementTag) { + TraceSection s( + "ViewTransitionModule::createViewTransitionInstance", "name", name); if (uiManager_ == nullptr) { return; } @@ -220,6 +233,7 @@ RootShadowNode::Unshared ViewTransitionModule::shadowTreeWillCommit( if (oldPseudoElementNodes_.empty()) { return newRootShadowNode; } + TraceSection s("ViewTransitionModule::shadowTreeWillCommit"); auto surfaceId = shadowTree.getSurfaceId(); @@ -333,6 +347,8 @@ void ViewTransitionModule::restoreViewTransitionName( } void ViewTransitionModule::applySnapshotsOnPseudoElementShadowNodes() { + TraceSection s( + "ViewTransitionModule::applySnapshotsOnPseudoElementShadowNodes"); if (oldPseudoElementNodes_.empty() || uiManager_ == nullptr) { return; } @@ -353,6 +369,7 @@ void ViewTransitionModule::applySnapshotsOnPseudoElementShadowNodes() { LayoutMetrics ViewTransitionModule::captureLayoutMetricsFromRoot( const ShadowNode& shadowNode) { + TraceSection s("ViewTransitionModule::captureLayoutMetricsFromRoot"); if (uiManager_ == nullptr) { return EmptyLayoutMetrics; } @@ -399,6 +416,12 @@ void ViewTransitionModule::startViewTransition( // Mark transition as started transitionStarted_ = true; activeTransitionId_ = ++transitionIdCounter_; + + TraceSection s( + "ViewTransitionModule::startViewTransition", + "transitionId", + activeTransitionId_); + pendingAnimationIds_.clear(); onCompleteCallback_ = onCompleteCallback; @@ -456,6 +479,10 @@ void ViewTransitionModule::suspendOnActiveViewTransition() { } void ViewTransitionModule::startViewTransitionEnd() { + TraceSection s( + "ViewTransitionModule::startViewTransitionEnd", + "transitionId", + activeTransitionId_); auto finishedId = activeTransitionId_; // Only clear layout and registry entries belonging to the finished