Skip to content

Commit

Permalink
Fabric: ShadowTree::getRootShadowNode was removed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shergin authored and facebook-github-bot committed Jan 17, 2019
1 parent 84cf657 commit 9f71a8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 0 additions & 5 deletions ReactCommon/fabric/uimanager/ShadowTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions ReactCommon/fabric/uimanager/ShadowTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/*
Expand Down
5 changes: 4 additions & 1 deletion ReactCommon/fabric/uimanager/UIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});
}

Expand Down

0 comments on commit 9f71a8f

Please sign in to comment.