diff --git a/ReactCommon/fabric/uimanager/Scheduler.cpp b/ReactCommon/fabric/uimanager/Scheduler.cpp index cf08d8fc2..f3f8f76dc 100644 --- a/ReactCommon/fabric/uimanager/Scheduler.cpp +++ b/ReactCommon/fabric/uimanager/Scheduler.cpp @@ -95,7 +95,7 @@ void Scheduler::renderTemplateToSurface( *componentDescriptorRegistry_, nMR); - shadowTreeRegistry_.get(surfaceId, [=](const ShadowTree &shadowTree) { + shadowTreeRegistry_.visit(surfaceId, [=](const ShadowTree &shadowTree) { shadowTree.complete( std::make_shared(SharedShadowNodeList{tree})); }); @@ -106,7 +106,7 @@ void Scheduler::renderTemplateToSurface( } void Scheduler::stopSurface(SurfaceId surfaceId) const { - shadowTreeRegistry_.get(surfaceId, [](const ShadowTree &shadowTree) { + shadowTreeRegistry_.visit(surfaceId, [](const ShadowTree &shadowTree) { // As part of stopping the Surface, we have to commit an empty tree. shadowTree.complete(std::const_pointer_cast( ShadowNode::emptySharedShadowNodeSharedList())); @@ -127,7 +127,7 @@ Size Scheduler::measureSurface( const LayoutConstraints &layoutConstraints, const LayoutContext &layoutContext) const { Size size; - shadowTreeRegistry_.get(surfaceId, [&](const ShadowTree &shadowTree) { + shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { size = shadowTree.measure(layoutConstraints, layoutContext); }); return size; @@ -137,7 +137,7 @@ void Scheduler::constraintSurfaceLayout( SurfaceId surfaceId, const LayoutConstraints &layoutConstraints, const LayoutContext &layoutContext) const { - shadowTreeRegistry_.get(surfaceId, [&](const ShadowTree &shadowTree) { + shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { shadowTree.synchronize([&]() { shadowTree.constraintLayout(layoutConstraints, layoutContext); }); @@ -170,7 +170,7 @@ void Scheduler::shadowTreeDidCommit( void Scheduler::uiManagerDidFinishTransaction( SurfaceId surfaceId, const SharedShadowNodeUnsharedList &rootChildNodes) { - shadowTreeRegistry_.get(surfaceId, [&](const ShadowTree &shadowTree) { + shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree &shadowTree) { shadowTree.complete(rootChildNodes); }); } diff --git a/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp b/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp index acde471a5..24babca90 100644 --- a/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp +++ b/ReactCommon/fabric/uimanager/ShadowTreeRegistry.cpp @@ -24,7 +24,7 @@ std::unique_ptr ShadowTreeRegistry::remove( return shadowTree; } -bool ShadowTreeRegistry::get( +bool ShadowTreeRegistry::visit( SurfaceId surfaceId, std::function callback) const { std::shared_lock lock(mutex_); diff --git a/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h b/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h index 5df5fc0bb..24ac33a88 100644 --- a/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h +++ b/ReactCommon/fabric/uimanager/ShadowTreeRegistry.h @@ -44,7 +44,7 @@ class ShadowTreeRegistry final { * `surfaceId`, otherwise returns `false` without calling the `callback`. * Can be called from any thread. */ - bool get( + bool visit( SurfaceId surfaceId, std::function callback) const; diff --git a/ReactCommon/fabric/uimanager/UIManager.cpp b/ReactCommon/fabric/uimanager/UIManager.cpp index 16a7ffbeb..a5b1f70a7 100644 --- a/ReactCommon/fabric/uimanager/UIManager.cpp +++ b/ReactCommon/fabric/uimanager/UIManager.cpp @@ -84,7 +84,7 @@ void UIManager::setNativeProps( auto props = componentDescriptor.cloneProps(shadowNode->getProps(), rawProps); auto newShadowNode = shadowNode->clone(ShadowNodeFragment{.props = props}); - shadowTreeRegistry_->get( + shadowTreeRegistry_->visit( shadowNode->getRootTag(), [&](const ShadowTree &shadowTree) { shadowTree.completeByReplacingShadowNode(shadowNode, newShadowNode); }); @@ -96,7 +96,7 @@ LayoutMetrics UIManager::getRelativeLayoutMetrics( SystraceSection s("UIManager::getRelativeLayoutMetrics"); if (!ancestorShadowNode) { - shadowTreeRegistry_->get( + shadowTreeRegistry_->visit( shadowNode.getRootTag(), [&](const ShadowTree &shadowTree) { ancestorShadowNode = shadowTree.getRootShadowNode().get(); });