Remove deprecated ShadowNode type aliases

Summary:
Fix todo and inconsistency across codebase. It's better to have just one way to refer to these types.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D37653146

fbshipit-source-id: e82f09caa6cd6eec5512b78f413708d9c04a7a83
This commit is contained in:
Pieter De Baets 2022-07-12 04:37:32 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 53c8fc9488
Коммит 13a0556aaa
17 изменённых файлов: 188 добавлений и 187 удалений

Просмотреть файл

@ -120,8 +120,8 @@ static void testShadowNodeTreeLifeCycleLayoutAnimations(
auto currentRootNode = std::static_pointer_cast<RootShadowNode const>(
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{singleRootChildNode})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{singleRootChildNode})}));
// Building an initial view hierarchy.
auto viewTree = buildStubViewTreeWithoutUsingDifferentiator(*emptyRootNode);

Просмотреть файл

@ -126,7 +126,7 @@ bool ComponentDescriptorRegistry::hasComponentDescriptorAt(
return true;
}
SharedShadowNode ComponentDescriptorRegistry::createNode(
ShadowNode::Shared ComponentDescriptorRegistry::createNode(
Tag tag,
std::string const &viewName,
SurfaceId surfaceId,

Просмотреть файл

@ -22,9 +22,9 @@
namespace facebook {
namespace react {
SharedShadowNodeSharedList ShadowNode::emptySharedShadowNodeSharedList() {
ShadowNode::SharedListOfShared ShadowNode::emptySharedShadowNodeSharedList() {
static const auto emptySharedShadowNodeSharedList =
std::make_shared<SharedShadowNodeList>();
std::make_shared<ShadowNode::ListOfShared>();
return emptySharedShadowNodeSharedList;
}
@ -131,7 +131,7 @@ ComponentHandle ShadowNode::getComponentHandle() const {
return family_->getComponentHandle();
}
const SharedShadowNodeList &ShadowNode::getChildren() const {
const ShadowNode::ListOfShared &ShadowNode::getChildren() const {
return *children_;
}
@ -192,7 +192,7 @@ void ShadowNode::appendChild(const ShadowNode::Shared &child) {
cloneChildrenIfShared();
auto nonConstChildren =
std::const_pointer_cast<SharedShadowNodeList>(children_);
std::const_pointer_cast<ShadowNode::ListOfShared>(children_);
nonConstChildren->push_back(child);
child->family_->setParent(family_);
@ -237,7 +237,7 @@ void ShadowNode::cloneChildrenIfShared() {
}
traits_.unset(ShadowNodeTraits::Trait::ChildrenAreShared);
children_ = std::make_shared<SharedShadowNodeList>(*children_);
children_ = std::make_shared<ShadowNode::ListOfShared>(*children_);
}
void ShadowNode::setMounted(bool mounted) const {
@ -285,7 +285,7 @@ ShadowNode::Unshared ShadowNode::cloneTree(
childNode = parentNode.clone({
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(children),
std::make_shared<ShadowNode::ListOfShared>(children),
});
}

Просмотреть файл

@ -28,15 +28,6 @@ static constexpr const int kShadowNodeChildrenSmallVectorSize = 8;
class ComponentDescriptor;
struct ShadowNodeFragment;
class ShadowNode;
// Deprecated: Use ShadowNode::Shared instead
using SharedShadowNode = std::shared_ptr<const ShadowNode>;
using WeakShadowNode = std::weak_ptr<const ShadowNode>;
using SharedShadowNodeList =
butter::small_vector<SharedShadowNode, kShadowNodeChildrenSmallVectorSize>;
using SharedShadowNodeSharedList = std::shared_ptr<const SharedShadowNodeList>;
using SharedShadowNodeUnsharedList = std::shared_ptr<SharedShadowNodeList>;
class ShadowNode : public Sealable, public DebugStringConvertible {
public:
@ -57,7 +48,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
int /* childIndex */>,
64>;
static SharedShadowNodeSharedList emptySharedShadowNodeSharedList();
static SharedListOfShared emptySharedShadowNodeSharedList();
/*
* Returns `true` if nodes belong to the same family (they were cloned one
@ -103,7 +94,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
/*
* Clones the shadow node using stored `cloneFunction`.
*/
ShadowNode::Unshared clone(const ShadowNodeFragment &fragment) const;
Unshared clone(const ShadowNodeFragment &fragment) const;
/*
* Clones the node (and partially the tree starting from the node) by
@ -112,10 +103,10 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
*
* Returns `nullptr` if the operation cannot be performed successfully.
*/
ShadowNode::Unshared cloneTree(
Unshared cloneTree(
ShadowNodeFamily const &shadowNodeFamily,
std::function<ShadowNode::Unshared(ShadowNode const &oldShadowNode)> const
&callback) const;
std::function<Unshared(ShadowNode const &oldShadowNode)> const &callback)
const;
#pragma mark - Getters
@ -128,7 +119,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
ShadowNodeTraits getTraits() const;
SharedProps const &getProps() const;
SharedShadowNodeList const &getChildren() const;
ListOfShared const &getChildren() const;
SharedEventEmitter const &getEventEmitter() const;
Tag getTag() const;
SurfaceId getSurfaceId() const;
@ -165,10 +156,10 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
#pragma mark - Mutating Methods
void appendChild(ShadowNode::Shared const &child);
void appendChild(Shared const &child);
void replaceChild(
ShadowNode const &oldChild,
ShadowNode::Shared const &newChild,
Shared const &newChild,
int suggestedIndex = -1);
/*
@ -196,7 +187,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible {
protected:
SharedProps props_;
SharedShadowNodeSharedList children_;
SharedListOfShared children_;
State::Shared state_;
int orderIndex_;

Просмотреть файл

@ -37,7 +37,7 @@ TEST(ComponentDescriptorTest, createShadowNode) {
},
nullptr);
SharedShadowNode node = descriptor->createShadowNode(
ShadowNode::Shared node = descriptor->createShadowNode(
ShadowNodeFragment{
/* .props = */ props,
},
@ -69,12 +69,12 @@ TEST(ComponentDescriptorTest, cloneShadowNode) {
/* .eventEmitter = */ nullptr,
},
nullptr);
SharedShadowNode node = descriptor->createShadowNode(
ShadowNode::Shared node = descriptor->createShadowNode(
ShadowNodeFragment{
/* .props = */ props,
},
family);
SharedShadowNode cloned = descriptor->cloneShadowNode(*node, {});
ShadowNode::Shared cloned = descriptor->cloneShadowNode(*node, {});
EXPECT_STREQ(cloned->getComponentName(), "Test");
EXPECT_EQ(cloned->getTag(), 9);
@ -104,7 +104,7 @@ TEST(ComponentDescriptorTest, appendChild) {
/* .eventEmitter = */ nullptr,
},
nullptr);
SharedShadowNode node1 = descriptor->createShadowNode(
ShadowNode::Shared node1 = descriptor->createShadowNode(
ShadowNodeFragment{
/* .props = */ props,
},
@ -116,7 +116,7 @@ TEST(ComponentDescriptorTest, appendChild) {
/* .eventEmitter = */ nullptr,
},
nullptr);
SharedShadowNode node2 = descriptor->createShadowNode(
ShadowNode::Shared node2 = descriptor->createShadowNode(
ShadowNodeFragment{
/* .props = */ props,
},
@ -128,7 +128,7 @@ TEST(ComponentDescriptorTest, appendChild) {
/* .eventEmitter = */ nullptr,
},
nullptr);
SharedShadowNode node3 = descriptor->createShadowNode(
ShadowNode::Shared node3 = descriptor->createShadowNode(
ShadowNodeFragment{
/* .props = */ props,
},

Просмотреть файл

@ -85,8 +85,8 @@ class ShadowNodeTest : public ::testing::Test {
familyABB,
traits);
auto nodeABChildren = std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{nodeABA_, nodeABB_});
auto nodeABChildren = std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{nodeABA_, nodeABB_});
auto familyAB = std::make_shared<ShadowNodeFamily>(
ShadowNodeFamilyFragment{
@ -120,8 +120,8 @@ class ShadowNodeTest : public ::testing::Test {
familyAC,
traits);
auto nodeAChildren = std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{nodeAA_, nodeAB_, nodeAC_});
auto nodeAChildren = std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{nodeAA_, nodeAB_, nodeAC_});
auto familyA = std::make_shared<ShadowNodeFamily>(
ShadowNodeFamilyFragment{

Просмотреть файл

@ -161,8 +161,8 @@ static ShadowNode::Unshared progressState(
}
static void updateMountedFlag(
const SharedShadowNodeList &oldChildren,
const SharedShadowNodeList &newChildren) {
const ShadowNode::ListOfShared &oldChildren,
const ShadowNode::ListOfShared &newChildren) {
// This is a simplified version of Diffing algorithm that only updates
// `mounted` flag on `ShadowNode`s. The algorithm sets "mounted" flag before
// "unmounted" to allow `ShadowNode` detect a situation where the node was

Просмотреть файл

@ -50,7 +50,7 @@ static ShadowNode::Shared makeNode(
return componentDescriptor.createShadowNode(
ShadowNodeFragment{
props, std::make_shared<SharedShadowNodeList>(children)},
props, std::make_shared<ShadowNode::ListOfShared>(children)},
componentDescriptor.createFamily({tag, SurfaceId(1), nullptr}, nullptr));
}
@ -111,32 +111,32 @@ TEST(MountingTest, testReorderingInstructionGeneration) {
auto shadowNodeV1 = viewComponentDescriptor.createShadowNode(
ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childB, childC, childD})},
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childB, childC, childD})},
family);
auto shadowNodeV2 = shadowNodeV1->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childA, childB, childC, childD})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childA, childB, childC, childD})});
auto shadowNodeV3 = shadowNodeV2->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childB, childC, childD})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childB, childC, childD})});
auto shadowNodeV4 = shadowNodeV3->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childB, childD, childE})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childB, childD, childE})});
auto shadowNodeV5 = shadowNodeV4->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childB, childA, childE, childC})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childB, childA, childE, childC})});
auto shadowNodeV6 = shadowNodeV5->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList{
std::make_shared<ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childB, childA, childD, childF, childE, childC})});
auto shadowNodeV7 = shadowNodeV6->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList{
std::make_shared<ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childF,
childE,
childC,
@ -151,38 +151,38 @@ TEST(MountingTest, testReorderingInstructionGeneration) {
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV1})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV1})}));
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV1->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV2})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV2})}));
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV2->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV3})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV3})}));
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV3->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV4})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV4})}));
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV4->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV5})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV5})}));
auto rootNodeV6 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV5->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV6})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV6})}));
auto rootNodeV7 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV6->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV7})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV7})}));
// Layout
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};
@ -419,159 +419,169 @@ TEST(MountingTest, testViewReparentingInstructionGeneration) {
auto reparentedViewA = makeNode(
viewComponentDescriptor,
1000,
SharedShadowNodeList{
ShadowNode::ListOfShared{
childC->clone({}), childA->clone({}), childB->clone({})});
auto reparentedViewB = makeNode(
viewComponentDescriptor,
2000,
SharedShadowNodeList{
ShadowNode::ListOfShared{
childF->clone({}), childE->clone({}), childD->clone({})});
// Root -> G* -> H -> I -> J -> A* [nodes with * are _not_ flattened]
auto shadowNodeV1 = viewComponentDescriptor.createShadowNode(
ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childG->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childG->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childH->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childH->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(SharedShadowNodeList{
childI->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(
SharedShadowNodeList{
reparentedViewA->clone(
{})})})})})})})})})})},
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childI->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
reparentedViewA->clone(
{})})})})})})})})})})},
family);
// Root -> G* -> H* -> I -> J -> A* [nodes with * are _not_ flattened]
auto shadowNodeV2 = shadowNodeV1->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childG->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childG->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childH->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childH->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childI->clone(ShadowNodeFragment{
std::make_shared<
ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childI->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(SharedShadowNodeList{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{
reparentedViewA->clone(
{})})})})})})})})})})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
reparentedViewA->clone(
{})})})})})})})})})})});
// Root -> G* -> H -> I -> J -> A* [nodes with * are _not_ flattened]
auto shadowNodeV3 = shadowNodeV2->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childG->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childG->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childH->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childH->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childI->clone(ShadowNodeFragment{
std::make_shared<
ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childI->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(SharedShadowNodeList{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{
reparentedViewA->clone(
{})})})})})})})})})})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
reparentedViewA->clone(
{})})})})})})})})})})});
// The view is reparented 1 level down with a different sibling
// Root -> G* -> H* -> I* -> J -> [B*, A*] [nodes with * are _not_ flattened]
auto shadowNodeV4 = shadowNodeV3->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childG->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childG->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childH->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childH->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childI->clone(ShadowNodeFragment{
std::make_shared<
ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childI->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(SharedShadowNodeList{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{
reparentedViewB->clone({}),
reparentedViewA->clone(
{})})})})})})})})})})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childJ->clone(ShadowNodeFragment{
generateDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
reparentedViewB->clone({}),
reparentedViewA->clone(
{})})})})})})})})})})});
// The view is reparented 1 level further down with its order with the sibling
// swapped
// Root -> G* -> H* -> I* -> J* -> [A*, B*] [nodes with * are _not_ flattened]
auto shadowNodeV5 = shadowNodeV4->clone(ShadowNodeFragment{
generateDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childG->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childG->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childH->clone(ShadowNodeFragment{
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{childH->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{childI->clone(ShadowNodeFragment{
std::make_shared<
ShadowNode::ListOfShared>(ShadowNode::ListOfShared{
childI->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(viewComponentDescriptor),
std::make_shared<
SharedShadowNodeList>(SharedShadowNodeList{
childJ->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(
viewComponentDescriptor),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{
reparentedViewA->clone({}),
reparentedViewB->clone(
{})})})})})})})})})})});
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
childJ->clone(ShadowNodeFragment{
nonFlattenedDefaultProps(
viewComponentDescriptor),
std::make_shared<
ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{
reparentedViewA->clone({}),
reparentedViewB->clone(
{})})})})})})})})})})});
// Injecting a tree into the root node.
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV1})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV1})}));
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV1->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV2})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV2})}));
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV2->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV3})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV3})}));
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV3->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV4})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV4})}));
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
rootNodeV4->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{shadowNodeV5})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{shadowNodeV5})}));
// Layout
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};

Просмотреть файл

@ -77,8 +77,8 @@ static void testShadowNodeTreeLifeCycle(
auto currentRootNode = std::static_pointer_cast<RootShadowNode const>(
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{singleRootChildNode})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{singleRootChildNode})}));
// Building an initial view hierarchy.
auto viewTree = buildStubViewTreeWithoutUsingDifferentiator(*emptyRootNode);
@ -227,8 +227,8 @@ static void testShadowNodeTreeLifeCycleExtensiveFlatteningUnflattening(
auto currentRootNode = std::static_pointer_cast<RootShadowNode const>(
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{singleRootChildNode})}));
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{singleRootChildNode})}));
// Building an initial view hierarchy.
auto viewTree = buildStubViewTreeWithoutUsingDifferentiator(*emptyRootNode);

Просмотреть файл

@ -264,8 +264,8 @@ void Scheduler::renderTemplateToSurface(
ShadowNodeFragment{
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
/* .children = */
std::make_shared<SharedShadowNodeList>(
SharedShadowNodeList{tree}),
std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared{tree}),
});
});
});

Просмотреть файл

@ -25,17 +25,17 @@ bool constexpr DEBUG_FLY = false;
struct RBCContext {
const Tag rootTag;
const std::vector<SharedShadowNode> &nodes;
const std::vector<ShadowNode::Shared> &nodes;
const std::vector<folly::dynamic> &registers;
const ComponentDescriptorRegistry &componentDescriptorRegistry;
const NativeModuleRegistry &nativeModuleRegistry;
};
// TODO: use RBCContext instead of all the separate arguments.
SharedShadowNode UITemplateProcessor::runCommand(
ShadowNode::Shared UITemplateProcessor::runCommand(
const folly::dynamic &command,
SurfaceId surfaceId,
std::vector<SharedShadowNode> &nodes,
std::vector<ShadowNode::Shared> &nodes,
std::vector<folly::dynamic> &registers,
const ComponentDescriptorRegistry &componentDescriptorRegistry,
const NativeModuleRegistry &nativeModuleRegistry,
@ -100,7 +100,7 @@ SharedShadowNode UITemplateProcessor::runCommand(
return nullptr;
}
SharedShadowNode UITemplateProcessor::buildShadowTree(
ShadowNode::Shared UITemplateProcessor::buildShadowTree(
const std::string &jsonStr,
SurfaceId surfaceId,
const folly::dynamic &params,
@ -122,7 +122,7 @@ SharedShadowNode UITemplateProcessor::buildShadowTree(
}
auto parsed = folly::parseJson(content);
auto commands = parsed["commands"];
std::vector<SharedShadowNode> nodes(commands.size() * 2);
std::vector<ShadowNode::Shared> nodes(commands.size() * 2);
std::vector<folly::dynamic> registers(32);
for (const auto &command : commands) {
try {
@ -148,7 +148,7 @@ SharedShadowNode UITemplateProcessor::buildShadowTree(
LOG(ERROR) << "react ui template missing returnRoot command :(";
throw std::runtime_error(
"Missing returnRoot command in template content:\n" + content);
return SharedShadowNode{};
return ShadowNode::Shared{};
}
} // namespace react

Просмотреть файл

@ -56,7 +56,7 @@ class UITemplateProcessor {
static ShadowNode::Shared runCommand(
const folly::dynamic &command,
Tag rootTag,
std::vector<SharedShadowNode> &nodes,
std::vector<ShadowNode::Shared> &nodes,
std::vector<folly::dynamic> &registers,
const ComponentDescriptorRegistry &componentDescriptorRegistry,
const NativeModuleRegistry &nativeModuleRegistry,

Просмотреть файл

@ -52,7 +52,7 @@ UIManager::~UIManager() {
<< ").";
}
SharedShadowNode UIManager::createNode(
ShadowNode::Shared UIManager::createNode(
Tag tag,
std::string const &name,
SurfaceId surfaceId,
@ -100,9 +100,9 @@ SharedShadowNode UIManager::createNode(
return shadowNode;
}
SharedShadowNode UIManager::cloneNode(
ShadowNode::Shared UIManager::cloneNode(
ShadowNode const &shadowNode,
SharedShadowNodeSharedList const &children,
ShadowNode::SharedListOfShared const &children,
RawProps const *rawProps) const {
SystraceSection s("UIManager::cloneNode");
@ -138,7 +138,7 @@ void UIManager::appendChild(
void UIManager::completeSurface(
SurfaceId surfaceId,
SharedShadowNodeUnsharedList const &rootChildren,
ShadowNode::UnsharedListOfShared const &rootChildren,
ShadowTree::CommitOptions commitOptions) const {
SystraceSection s("UIManager::completeSurface");

Просмотреть файл

@ -120,7 +120,7 @@ class UIManager final : public ShadowTreeDelegate {
ShadowNode::Shared cloneNode(
ShadowNode const &shadowNode,
SharedShadowNodeSharedList const &children = nullptr,
ShadowNode::SharedListOfShared const &children = nullptr,
RawProps const *rawProps = nullptr) const;
void appendChild(
@ -129,7 +129,7 @@ class UIManager final : public ShadowTreeDelegate {
void completeSurface(
SurfaceId surfaceId,
SharedShadowNodeUnsharedList const &rootChildren,
ShadowNode::UnsharedListOfShared const &rootChildren,
ShadowTree::CommitOptions commitOptions) const;
void setIsJSResponder(

Просмотреть файл

@ -361,8 +361,8 @@ jsi::Value UIManagerBinding::get(
jsi::Value const &thisValue,
jsi::Value const *arguments,
size_t count) noexcept -> jsi::Value {
auto shadowNodeList =
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList({}));
auto shadowNodeList = std::make_shared<ShadowNode::ListOfShared>(
ShadowNode::ListOfShared({}));
return valueFromShadowNodeList(runtime, shadowNodeList);
});
}

Просмотреть файл

@ -27,7 +27,7 @@ struct EventHandlerWrapper : public EventHandler {
};
struct ShadowNodeWrapper : public jsi::HostObject {
ShadowNodeWrapper(SharedShadowNode shadowNode)
ShadowNodeWrapper(ShadowNode::Shared shadowNode)
: shadowNode(std::move(shadowNode)) {}
// The below method needs to be implemented out-of-line in order for the class
@ -39,7 +39,7 @@ struct ShadowNodeWrapper : public jsi::HostObject {
};
struct ShadowNodeListWrapper : public jsi::HostObject {
ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList)
ShadowNodeListWrapper(ShadowNode::UnsharedListOfShared shadowNodeList)
: shadowNodeList(shadowNodeList) {}
// The below method needs to be implemented out-of-line in order for the class
@ -47,7 +47,7 @@ struct ShadowNodeListWrapper : public jsi::HostObject {
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable)
~ShadowNodeListWrapper() override;
SharedShadowNodeUnsharedList shadowNodeList;
ShadowNode::UnsharedListOfShared shadowNodeList;
};
inline static ShadowNode::Shared shadowNodeFromValue(
@ -64,12 +64,12 @@ inline static ShadowNode::Shared shadowNodeFromValue(
inline static jsi::Value valueFromShadowNode(
jsi::Runtime &runtime,
const ShadowNode::Shared &shadowNode) {
ShadowNode::Shared shadowNode) {
return jsi::Object::createFromHostObject(
runtime, std::make_shared<ShadowNodeWrapper>(shadowNode));
runtime, std::make_shared<ShadowNodeWrapper>(std::move(shadowNode)));
}
inline static SharedShadowNodeUnsharedList shadowNodeListFromValue(
inline static ShadowNode::UnsharedListOfShared shadowNodeListFromValue(
jsi::Runtime &runtime,
jsi::Value const &value) {
return value.getObject(runtime)
@ -107,7 +107,7 @@ inline static ShadowNode::UnsharedListOfWeak weakShadowNodeListFromValue(
inline static jsi::Value valueFromShadowNodeList(
jsi::Runtime &runtime,
const SharedShadowNodeUnsharedList &shadowNodeList) {
const ShadowNode::UnsharedListOfShared &shadowNodeList) {
return jsi::Object::createFromHostObject(
runtime, std::make_unique<ShadowNodeListWrapper>(shadowNodeList));
}

Просмотреть файл

@ -308,7 +308,7 @@ static inline ShadowNode::Shared generateShadowNodeTree(
return componentDescriptor.createShadowNode(
ShadowNodeFragment{
generateDefaultProps(componentDescriptor),
std::make_shared<SharedShadowNodeList>(children)},
std::make_shared<ShadowNode::ListOfShared>(children)},
family);
}