Fabric: `ShadowTreeRegistry::get` was renamed to `ShadowTreeRegistry::visit`

Summary: Trivial. The name `visit` expresss intent more clearly and fits C++17 `std::visit` pattern.

Reviewed By: mdvacca

Differential Revision: D13269744

fbshipit-source-id: 6aa6569c58aa66673e3f3a1662390a74290b8e01
This commit is contained in:
Valentin Shergin 2018-11-30 17:24:57 -08:00 committed by Facebook Github Bot
parent d150cbc298
commit 757518edba
4 changed files with 9 additions and 9 deletions

View File

@ -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>(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<SharedShadowNodeList>(
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);
});
}

View File

@ -24,7 +24,7 @@ std::unique_ptr<ShadowTree> ShadowTreeRegistry::remove(
return shadowTree;
}
bool ShadowTreeRegistry::get(
bool ShadowTreeRegistry::visit(
SurfaceId surfaceId,
std::function<void(const ShadowTree &shadowTree)> callback) const {
std::shared_lock<folly::SharedMutex> lock(mutex_);

View File

@ -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<void(const ShadowTree &shadowTree)> callback) const;

View File

@ -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();
});