Fabric: Using `traitCast` in `layoutMetricsFromShadowNode`
Summary: We use this function in Diffing, and Diffing is one of the hottest pieces of Fabric. Removing `dynamic_cast` here should improve perf. See the previous diff for more details. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20052023 fbshipit-source-id: d6427ebf076d7f8244f0aeaf16407efa2368957e
This commit is contained in:
Родитель
b9e5ebd640
Коммит
3400135487
|
@ -12,11 +12,11 @@
|
|||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static LayoutMetrics layoutMetricsFromShadowNode(const ShadowNode &shadowNode) {
|
||||
auto layoutableShadowNode =
|
||||
dynamic_cast<const LayoutableShadowNode *>(&shadowNode);
|
||||
return layoutableShadowNode ? layoutableShadowNode->getLayoutMetrics()
|
||||
: EmptyLayoutMetrics;
|
||||
static LayoutMetrics layoutMetricsFromShadowNode(ShadowNode const &shadowNode) {
|
||||
auto layotableShadowNode =
|
||||
traitCast<LayoutableShadowNode const *>(&shadowNode);
|
||||
return layotableShadowNode ? layotableShadowNode->getLayoutMetrics()
|
||||
: EmptyLayoutMetrics;
|
||||
}
|
||||
|
||||
ShadowView::ShadowView(const ShadowNode &shadowNode)
|
||||
|
|
Загрузка…
Ссылка в новой задаче