Skip to content

Commit

Permalink
Fabric: Debug Pretty-printing is now debug only feature
Browse files Browse the repository at this point in the history
Summary: That should save us some app size kilobytes.

Reviewed By: mdvacca

Differential Revision: D10081499

fbshipit-source-id: 2b950768c609b412f9be332c22b6b1e96657e5ea
  • Loading branch information
shergin authored and facebook-github-bot committed Sep 28, 2018
1 parent 02ad56f commit e3b61f5
Show file tree
Hide file tree
Showing 39 changed files with 102 additions and 31 deletions.
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/AttributedString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ bool AttributedString::operator!=(const AttributedString &rhs) const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList AttributedString::getDebugChildren() const {
auto list = SharedDebugStringConvertibleList {};

Expand All @@ -103,6 +104,7 @@ SharedDebugStringConvertibleList AttributedString::getDebugChildren() const {

return list;
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/AttributedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ class AttributedString:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugChildren() const override;
#endif

private:

Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace react {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
return {
debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines),
Expand All @@ -25,6 +26,7 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
debugStringConvertibleItem("maximumFontSize", maximumFontSize)
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/ParagraphAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class ParagraphAttributes:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/TextAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ bool TextAttributes::operator!=(const TextAttributes &rhs) const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
return {
// Color
Expand Down Expand Up @@ -153,6 +154,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
debugStringConvertibleItem("layoutDirection", layoutDirection),
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/attributedstring/TextAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class TextAttributes:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/image/ImageLocalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ImageRequest &ImageLocalData::getImageRequest() const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string ImageLocalData::getDebugName() const {
return "ImageLocalData";
}
Expand All @@ -32,6 +33,7 @@ SharedDebugStringConvertibleList ImageLocalData::getDebugProps() const {
debugStringConvertibleItem("imageSource", imageSource_)
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/image/ImageLocalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class ImageLocalData:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string getDebugName() const override;
SharedDebugStringConvertibleList getDebugProps() const override;
#endif

private:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Size ScrollViewLocalData::getContentSize() const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string ScrollViewLocalData::getDebugName() const {
return "ScrollViewLocalData";
}
Expand All @@ -31,6 +32,7 @@ SharedDebugStringConvertibleList ScrollViewLocalData::getDebugProps() const {
debugStringConvertibleItem("contentBoundingRect", contentBoundingRect)
};
}
#endif

} // namespace react
} // namespace facebook
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ class ScrollViewLocalData:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string getDebugName() const override;
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ScrollViewProps::ScrollViewProps(const ScrollViewProps &sourceProps, const RawPr

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
auto defaultScrollViewProps = ScrollViewProps {};

Expand Down Expand Up @@ -79,6 +80,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
debugStringConvertibleItem("snapToAlignment", snapToAlignment, defaultScrollViewProps.snapToAlignment),
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/scrollview/ScrollViewProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class ScrollViewProps final:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ BaseTextProps::BaseTextProps(const BaseTextProps &sourceProps, const RawProps &r

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList BaseTextProps::getDebugProps() const {
return textAttributes.getDebugProps();
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/basetext/BaseTextProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class BaseTextProps {

#pragma mark - DebugStringConvertible (partially)

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const;
#endif
};

} // namespace react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ folly::dynamic ParagraphLocalData::getDynamic() const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string ParagraphLocalData::getDebugName() const {
return "ParagraphLocalData";
}
Expand All @@ -46,6 +47,7 @@ SharedDebugStringConvertibleList ParagraphLocalData::getDebugProps() const {
debugStringConvertibleItem("attributedString", attributedString_, "")
};
}
#endif

} // namespace react
} // namespace facebook
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class ParagraphLocalData:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
std::string getDebugName() const override;
SharedDebugStringConvertibleList getDebugProps() const override;
#endif

private:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ParagraphProps::ParagraphProps(const ParagraphProps &sourceProps, const RawProps

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const {
return
ViewProps::getDebugProps() +
Expand All @@ -43,6 +44,7 @@ SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const {
debugStringConvertibleItem("isSelectable", isSelectable)
};
}
#endif

} // namespace react
} // namespace facebook
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class ParagraphProps:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;

#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ RawTextProps::RawTextProps(const RawTextProps &sourceProps, const RawProps &rawP

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList RawTextProps::getDebugProps() const {
return {
debugStringConvertibleItem("text", text)
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/rawtext/RawTextProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class RawTextProps:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/text/TextProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ TextProps::TextProps(const TextProps &sourceProps, const RawProps &rawProps):

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList TextProps::getDebugProps() const {
return BaseTextProps::getDebugProps();
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/text/text/TextProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class TextProps:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
3 changes: 2 additions & 1 deletion ReactCommon/fabric/components/view/ConcreteViewShadowNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class ConcreteViewShadowNode:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override {
auto list = SharedDebugStringConvertibleList {};

Expand All @@ -125,7 +126,7 @@ class ConcreteViewShadowNode:

return list;
}

#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/view/ViewProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ BorderMetrics ViewProps::resolveBorderMetrics(bool isRTL) const {

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList ViewProps::getDebugProps() const {
const auto &defaultViewProps = ViewProps();

Expand All @@ -78,6 +79,7 @@ SharedDebugStringConvertibleList ViewProps::getDebugProps() const {
debugStringConvertibleItem("backgroundColor", backgroundColor, defaultViewProps.backgroundColor),
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/view/ViewProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class ViewProps:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ YogaStylableProps::YogaStylableProps(const YogaStylableProps &sourceProps, const

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const {
auto defaultYogaStyle = YGStyle {};
return {
Expand Down Expand Up @@ -54,6 +55,7 @@ SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const {
debugStringConvertibleItem("aspectRatio", yogaStyle.aspectRatio, defaultYogaStyle.aspectRatio),
};
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/components/view/yoga/YogaStylableProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class YogaStylableProps {

#pragma mark - DebugStringConvertible (Partial)

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const;
#endif
};

} // namespace react
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void LayoutableShadowNode::layoutChildren(LayoutContext layoutContext) {
// Default implementation does nothing.
}

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const {
auto list = SharedDebugStringConvertibleList {};

Expand Down Expand Up @@ -128,6 +129,7 @@ SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const {

return list;
}
#endif

} // namespace react
} // namespace facebook
2 changes: 2 additions & 0 deletions ReactCommon/fabric/core/layout/LayoutableShadowNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class LayoutableShadowNode:

#pragma mark - DebugStringConvertible

#if RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const;
#endif

private:
LayoutMetrics layoutMetrics_ {};
Expand Down
10 changes: 6 additions & 4 deletions ReactCommon/fabric/core/shadownode/LocalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ class LocalData:
public Sealable,
public DebugStringConvertible {

public:
virtual folly::dynamic getDynamic() const {
return folly::dynamic::object();
};
public:
virtual ~LocalData() = default;

virtual folly::dynamic getDynamic() const {
return folly::dynamic::object();
}
};

} // namespace react
Expand Down
Loading

0 comments on commit e3b61f5

Please sign in to comment.