Fabric: ShadowTree::getRootShadowNode was removed

Summary: Because it was not idiomatic anyway. There is no point having a pointer to RootShadowNode without any guarantees that it's the current one. Using `commit` method makes this concern explicit.

Reviewed By: sahrens

Differential Revision: D13615363

fbshipit-source-id: f71ffc3c55dbdc69624933eb8b92334ed793c794
This commit is contained in:
Valentin Shergin 2019-01-16 20:17:01 -08:00 committed by Facebook Github Bot
parent 84cf657308
commit 9f71a8f26e
3 changed files with 4 additions and 11 deletions

View File

@ -50,11 +50,6 @@ Tag ShadowTree::getSurfaceId() const {
return surfaceId_;
}
SharedRootShadowNode ShadowTree::getRootShadowNode() const {
std::shared_lock<folly::SharedMutex> lock(commitMutex_);
return rootShadowNode_;
}
bool ShadowTree::commit(
std::function<UnsharedRootShadowNode(
const SharedRootShadowNode &oldRootShadowNode)> transaction,

View File

@ -54,11 +54,6 @@ class ShadowTree final {
int attempts = 1,
int *revision = nullptr) const;
/*
* Returns a root shadow node that represents the last committed three.
*/
SharedRootShadowNode getRootShadowNode() const;
#pragma mark - Delegate
/*

View File

@ -100,7 +100,10 @@ LayoutMetrics UIManager::getRelativeLayoutMetrics(
if (!ancestorShadowNode) {
shadowTreeRegistry_->visit(
shadowNode.getRootTag(), [&](const ShadowTree &shadowTree) {
ancestorShadowNode = shadowTree.getRootShadowNode().get();
shadowTree.commit([&](const SharedRootShadowNode &oldRootShadowNode) {
ancestorShadowNode = oldRootShadowNode.get();
return nullptr;
});
});
}