Skip to content

Commit

Permalink
Replace usage of SharedShadowNode for ShadowNode::Shared
Browse files Browse the repository at this point in the history
Summary:
ShadowNode::Shared and SharedShadowNode represent the exact same type. Nowadays we use ShadowNode::Shared instead of SharedShadowNode.
This diff replaces usages of SharedShadowNode for ShadowNode::Shared in the fabric folder.

Changelog: [internal]

Reviewed By: shergin

Differential Revision: D19217717

fbshipit-source-id: 112331b22251aa3a3d5e183395c54f2ca0f56e47
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jan 30, 2020
1 parent de95457 commit 4bfe893
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
}
};

void appendChild(const SharedShadowNode &child) {
void appendChild(const ShadowNode::Shared &child) {
ensureUnsealed();

ShadowNode::appendChild(child);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class ComponentDescriptor {
* Appends (by mutating) a given `childShadowNode` to `parentShadowNode`.
*/
virtual void appendChild(
const SharedShadowNode &parentShadowNode,
const SharedShadowNode &childShadowNode) const = 0;
const ShadowNode::Shared &parentShadowNode,
const ShadowNode::Shared &childShadowNode) const = 0;

/*
* Creates a new `Props` of a particular type with all values copied from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
}

void appendChild(
const SharedShadowNode &parentShadowNode,
const SharedShadowNode &childShadowNode) const override {
const ShadowNode::Shared &parentShadowNode,
const ShadowNode::Shared &childShadowNode) const override {
assert(
dynamic_cast<ConcreteShadowNode const *>(parentShadowNode.get()) &&
"Provided `parentShadowNode` has an incompatible type.");
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/fabric/core/shadownode/ShadowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void ShadowNode::sealRecursive() const {

#pragma mark - Mutating Methods

void ShadowNode::appendChild(const SharedShadowNode &child) {
void ShadowNode::appendChild(const ShadowNode::Shared &child) {
ensureUnsealed();

cloneChildrenIfShared();
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ComponentDescriptorRegistry {
ComponentDescriptor const &at(std::string const &componentName) const;
ComponentDescriptor const &at(ComponentHandle componentHandle) const;

SharedShadowNode createNode(
ShadowNode::Shared createNode(
Tag tag,
std::string const &viewName,
SurfaceId surfaceId,
Expand Down
6 changes: 3 additions & 3 deletions ReactCommon/fabric/uimanager/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void Scheduler::uiManagerDidFinishTransaction(
}

void Scheduler::uiManagerDidCreateShadowNode(
const SharedShadowNode &shadowNode) {
const ShadowNode::Shared &shadowNode) {
SystraceSection s("Scheduler::uiManagerDidCreateShadowNode");

if (delegate_) {
Expand All @@ -296,7 +296,7 @@ void Scheduler::uiManagerDidCreateShadowNode(
}

void Scheduler::uiManagerDidDispatchCommand(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) {
SystraceSection s("Scheduler::uiManagerDispatchCommand");
Expand All @@ -312,7 +312,7 @@ void Scheduler::uiManagerDidDispatchCommand(
*/
void Scheduler::uiManagerDidSetJSResponder(
SurfaceId surfaceId,
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
bool blockNativeResponder) {
if (delegate_) {
// TODO: the first shadowView paramenter, should be the first parent that
Expand Down
6 changes: 3 additions & 3 deletions ReactCommon/fabric/uimanager/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ class Scheduler final : public UIManagerDelegate {
void uiManagerDidFinishTransaction(
MountingCoordinator::Shared const &mountingCoordinator) override;
void uiManagerDidCreateShadowNode(
const SharedShadowNode &shadowNode) override;
const ShadowNode::Shared &shadowNode) override;
void uiManagerDidDispatchCommand(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) override;
void uiManagerDidSetJSResponder(
SurfaceId surfaceId,
const SharedShadowNode &shadowView,
const ShadowNode::Shared &shadowView,
bool blockNativeResponder) override;
void uiManagerDidClearJSResponder() override;

Expand Down
10 changes: 5 additions & 5 deletions ReactCommon/fabric/uimanager/UIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ SharedShadowNode UIManager::createNode(
}

SharedShadowNode UIManager::cloneNode(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
const SharedShadowNodeSharedList &children,
const RawProps *rawProps) const {
SystraceSection s("UIManager::cloneNode");
Expand All @@ -95,8 +95,8 @@ SharedShadowNode UIManager::cloneNode(
}

void UIManager::appendChild(
const SharedShadowNode &parentShadowNode,
const SharedShadowNode &childShadowNode) const {
const ShadowNode::Shared &parentShadowNode,
const ShadowNode::Shared &childShadowNode) const {
SystraceSection s("UIManager::appendChild");

auto &componentDescriptor = parentShadowNode->getComponentDescriptor();
Expand All @@ -121,7 +121,7 @@ void UIManager::completeSurface(
}

void UIManager::setJSResponder(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
const bool blockNativeResponder) const {
if (delegate_) {
delegate_->uiManagerDidSetJSResponder(
Expand Down Expand Up @@ -217,7 +217,7 @@ void UIManager::updateState(
}

void UIManager::dispatchCommand(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) const {
if (delegate_) {
Expand Down
14 changes: 7 additions & 7 deletions ReactCommon/fabric/uimanager/UIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ class UIManager final : public ShadowTreeDelegate {
friend class UIManagerBinding;
friend class Scheduler;

SharedShadowNode createNode(
ShadowNode::Shared createNode(
Tag tag,
std::string const &componentName,
SurfaceId surfaceId,
const RawProps &props,
SharedEventTarget eventTarget) const;

SharedShadowNode cloneNode(
const SharedShadowNode &shadowNode,
ShadowNode::Shared cloneNode(
const ShadowNode::Shared &shadowNode,
const SharedShadowNodeSharedList &children = nullptr,
const RawProps *rawProps = nullptr) const;

void appendChild(
const SharedShadowNode &parentShadowNode,
const SharedShadowNode &childShadowNode) const;
const ShadowNode::Shared &parentShadowNode,
const ShadowNode::Shared &childShadowNode) const;

void completeSurface(
SurfaceId surfaceId,
Expand All @@ -83,7 +83,7 @@ class UIManager final : public ShadowTreeDelegate {
const;

void setJSResponder(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
const bool blockNativeResponder) const;

void clearJSResponder() const;
Expand Down Expand Up @@ -111,7 +111,7 @@ class UIManager final : public ShadowTreeDelegate {
StateData::Shared const &rawStateData) const;

void dispatchCommand(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) const;

Expand Down
6 changes: 3 additions & 3 deletions ReactCommon/fabric/uimanager/UIManagerDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class UIManagerDelegate {
* instances.
*/
virtual void uiManagerDidCreateShadowNode(
const SharedShadowNode &shadowNode) = 0;
const ShadowNode::Shared &shadowNode) = 0;

/*
* Called when UIManager wants to dispatch a command to the mounting layer.
*/
virtual void uiManagerDidDispatchCommand(
const SharedShadowNode &shadowNode,
const ShadowNode::Shared &shadowNode,
std::string const &commandName,
folly::dynamic const args) = 0;

Expand All @@ -47,7 +47,7 @@ class UIManagerDelegate {
*/
virtual void uiManagerDidSetJSResponder(
SurfaceId surfaceId,
SharedShadowNode const &shadowView,
ShadowNode::Shared const &shadowView,
bool blockNativeResponder) = 0;

/*
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/fabric/uimanager/UITemplateProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NativeModuleRegistry {

class UITemplateProcessor {
public:
static SharedShadowNode buildShadowTree(
static ShadowNode::Shared buildShadowTree(
const std::string &jsonStr,
int rootTag,
const folly::dynamic &params,
Expand All @@ -53,7 +53,7 @@ class UITemplateProcessor {
const std::shared_ptr<const ReactNativeConfig> reactNativeConfig);

private:
static SharedShadowNode runCommand(
static ShadowNode::Shared runCommand(
const folly::dynamic &command,
Tag rootTag,
std::vector<SharedShadowNode> &nodes,
Expand Down
6 changes: 3 additions & 3 deletions ReactCommon/fabric/uimanager/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct ShadowNodeWrapper : public jsi::HostObject {
ShadowNodeWrapper(SharedShadowNode shadowNode)
: shadowNode(std::move(shadowNode)) {}

SharedShadowNode shadowNode;
ShadowNode::Shared shadowNode;
};

struct ShadowNodeListWrapper : public jsi::HostObject {
Expand All @@ -37,7 +37,7 @@ struct ShadowNodeListWrapper : public jsi::HostObject {
SharedShadowNodeUnsharedList shadowNodeList;
};

inline static SharedShadowNode shadowNodeFromValue(
inline static ShadowNode::Shared shadowNodeFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return value.getObject(runtime)
Expand All @@ -47,7 +47,7 @@ inline static SharedShadowNode shadowNodeFromValue(

inline static jsi::Value valueFromShadowNode(
jsi::Runtime &runtime,
const SharedShadowNode &shadowNode) {
const ShadowNode::Shared &shadowNode) {
return jsi::Object::createFromHostObject(
runtime, std::make_shared<ShadowNodeWrapper>(shadowNode));
}
Expand Down

0 comments on commit 4bfe893

Please sign in to comment.