diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/fabric/attributedstring/AttributedString.cpp index 196b52983f6..7ad102a5575 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/fabric/attributedstring/AttributedString.cpp @@ -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 {}; @@ -103,6 +104,7 @@ SharedDebugStringConvertibleList AttributedString::getDebugChildren() const { return list; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/AttributedString.h b/ReactCommon/fabric/attributedstring/AttributedString.h index ecd6289f6bc..447001adbc5 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.h +++ b/ReactCommon/fabric/attributedstring/AttributedString.h @@ -77,7 +77,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugChildren() const override; +#endif private: diff --git a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp b/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp index 13ed8f4aa58..cdd130b276d 100644 --- a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp +++ b/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp @@ -16,6 +16,7 @@ namespace react { #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const { return { debugStringConvertibleItem("maximumNumberOfLines", maximumNumberOfLines), @@ -25,6 +26,7 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const { debugStringConvertibleItem("maximumFontSize", maximumFontSize) }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/ParagraphAttributes.h b/ReactCommon/fabric/attributedstring/ParagraphAttributes.h index 160ce1767c4..f5e4ef8d8e8 100644 --- a/ReactCommon/fabric/attributedstring/ParagraphAttributes.h +++ b/ReactCommon/fabric/attributedstring/ParagraphAttributes.h @@ -58,7 +58,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/attributedstring/TextAttributes.cpp b/ReactCommon/fabric/attributedstring/TextAttributes.cpp index 8ce27505c1f..313a79e7782 100644 --- a/ReactCommon/fabric/attributedstring/TextAttributes.cpp +++ b/ReactCommon/fabric/attributedstring/TextAttributes.cpp @@ -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 @@ -153,6 +154,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const { debugStringConvertibleItem("layoutDirection", layoutDirection), }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/attributedstring/TextAttributes.h b/ReactCommon/fabric/attributedstring/TextAttributes.h index d14d1f0bc51..8ba767fc30e 100644 --- a/ReactCommon/fabric/attributedstring/TextAttributes.h +++ b/ReactCommon/fabric/attributedstring/TextAttributes.h @@ -78,7 +78,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/image/ImageLocalData.cpp b/ReactCommon/fabric/components/image/ImageLocalData.cpp index e5247b5d6e7..c1f1a5525c3 100644 --- a/ReactCommon/fabric/components/image/ImageLocalData.cpp +++ b/ReactCommon/fabric/components/image/ImageLocalData.cpp @@ -23,6 +23,7 @@ const ImageRequest &ImageLocalData::getImageRequest() const { #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string ImageLocalData::getDebugName() const { return "ImageLocalData"; } @@ -32,6 +33,7 @@ SharedDebugStringConvertibleList ImageLocalData::getDebugProps() const { debugStringConvertibleItem("imageSource", imageSource_) }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/image/ImageLocalData.h b/ReactCommon/fabric/components/image/ImageLocalData.h index b453d1e1b49..ec50e5f35e6 100644 --- a/ReactCommon/fabric/components/image/ImageLocalData.h +++ b/ReactCommon/fabric/components/image/ImageLocalData.h @@ -44,8 +44,10 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string getDebugName() const override; SharedDebugStringConvertibleList getDebugProps() const override; +#endif private: diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp b/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp index 66329efed7d..b600d1afc5c 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp +++ b/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.cpp @@ -22,6 +22,7 @@ Size ScrollViewLocalData::getContentSize() const { #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string ScrollViewLocalData::getDebugName() const { return "ScrollViewLocalData"; } @@ -31,6 +32,7 @@ SharedDebugStringConvertibleList ScrollViewLocalData::getDebugProps() const { debugStringConvertibleItem("contentBoundingRect", contentBoundingRect) }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h b/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h index 9edb597dd8e..e02d7b250d6 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h +++ b/ReactCommon/fabric/components/scrollview/ScrollViewLocalData.h @@ -38,8 +38,10 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string getDebugName() const override; SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp b/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp index b5228d7e365..b44ae2704c2 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp +++ b/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp @@ -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 {}; @@ -79,6 +80,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const { debugStringConvertibleItem("snapToAlignment", snapToAlignment, defaultScrollViewProps.snapToAlignment), }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewProps.h b/ReactCommon/fabric/components/scrollview/ScrollViewProps.h index 0334fe3483d..c046315b71a 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewProps.h +++ b/ReactCommon/fabric/components/scrollview/ScrollViewProps.h @@ -51,7 +51,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp b/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp index 41c644f9224..c54363337cb 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp +++ b/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp @@ -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 diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextProps.h b/ReactCommon/fabric/components/text/basetext/BaseTextProps.h index a24aaa5dc2a..0751c0cbce9 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextProps.h +++ b/ReactCommon/fabric/components/text/basetext/BaseTextProps.h @@ -31,7 +31,9 @@ public: #pragma mark - DebugStringConvertible (partially) +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp index 69f5cdcbcef..f80630c2529 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.cpp @@ -37,6 +37,7 @@ folly::dynamic ParagraphLocalData::getDynamic() const { #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string ParagraphLocalData::getDebugName() const { return "ParagraphLocalData"; } @@ -46,6 +47,7 @@ SharedDebugStringConvertibleList ParagraphLocalData::getDebugProps() const { debugStringConvertibleItem("attributedString", attributedString_, "") }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h index b24f53d55f2..3ca3180c86a 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphLocalData.h @@ -45,8 +45,10 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string getDebugName() const override; SharedDebugStringConvertibleList getDebugProps() const override; +#endif private: diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp index b6bc970041c..32fc5b3e852 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp @@ -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() + @@ -43,6 +44,7 @@ SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const { debugStringConvertibleItem("isSelectable", isSelectable) }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h index 82636f5376d..8258bc08417 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h @@ -45,8 +45,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; - +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp b/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp index ac140878efc..b161ee01b02 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp +++ b/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp @@ -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 diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextProps.h b/ReactCommon/fabric/components/text/rawtext/RawTextProps.h index a12b96f4b62..0c098b9260c 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextProps.h +++ b/ReactCommon/fabric/components/text/rawtext/RawTextProps.h @@ -32,7 +32,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/text/text/TextProps.cpp b/ReactCommon/fabric/components/text/text/TextProps.cpp index 6a2de65aaa7..07d68ed20fa 100644 --- a/ReactCommon/fabric/components/text/text/TextProps.cpp +++ b/ReactCommon/fabric/components/text/text/TextProps.cpp @@ -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 diff --git a/ReactCommon/fabric/components/text/text/TextProps.h b/ReactCommon/fabric/components/text/text/TextProps.h index 593bc4e8dd1..86a78d5153a 100644 --- a/ReactCommon/fabric/components/text/text/TextProps.h +++ b/ReactCommon/fabric/components/text/text/TextProps.h @@ -26,7 +26,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h index cdb373c5d6f..a44153b8ebd 100644 --- a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h +++ b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h @@ -115,6 +115,7 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override { auto list = SharedDebugStringConvertibleList {}; @@ -125,7 +126,7 @@ public: return list; } - +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/view/ViewProps.cpp b/ReactCommon/fabric/components/view/ViewProps.cpp index 41ee01e5082..f367edfe55e 100644 --- a/ReactCommon/fabric/components/view/ViewProps.cpp +++ b/ReactCommon/fabric/components/view/ViewProps.cpp @@ -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(); @@ -78,6 +79,7 @@ SharedDebugStringConvertibleList ViewProps::getDebugProps() const { debugStringConvertibleItem("backgroundColor", backgroundColor, defaultViewProps.backgroundColor), }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/view/ViewProps.h b/ReactCommon/fabric/components/view/ViewProps.h index 96183feae5e..1027b961fa1 100644 --- a/ReactCommon/fabric/components/view/ViewProps.h +++ b/ReactCommon/fabric/components/view/ViewProps.h @@ -66,7 +66,9 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp index 8174995e09d..1367a28e032 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp @@ -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 { @@ -54,6 +55,7 @@ SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const { debugStringConvertibleItem("aspectRatio", yogaStyle.aspectRatio, defaultYogaStyle.aspectRatio), }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h index fd75fc840d6..c581104779b 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h +++ b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h @@ -33,7 +33,9 @@ public: #pragma mark - DebugStringConvertible (Partial) +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const; +#endif }; } // namespace react diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp index 55406dc9032..a25ecf8741e 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp @@ -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 {}; @@ -128,6 +129,7 @@ SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const { return list; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h index 3d25b791fb2..516b50e6881 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h @@ -108,7 +108,9 @@ protected: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const; +#endif private: LayoutMetrics layoutMetrics_ {}; diff --git a/ReactCommon/fabric/core/shadownode/LocalData.h b/ReactCommon/fabric/core/shadownode/LocalData.h index 603ee7ef6ef..71560fb77d9 100644 --- a/ReactCommon/fabric/core/shadownode/LocalData.h +++ b/ReactCommon/fabric/core/shadownode/LocalData.h @@ -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 diff --git a/ReactCommon/fabric/core/shadownode/Props.h b/ReactCommon/fabric/core/shadownode/Props.h index a25e4d0b1d2..f072f7a3a33 100644 --- a/ReactCommon/fabric/core/shadownode/Props.h +++ b/ReactCommon/fabric/core/shadownode/Props.h @@ -30,11 +30,13 @@ class Props: public: Props() = default; Props(const Props &sourceProps, const RawProps &rawProps); + virtual ~Props() = default; const std::string nativeId; - #ifdef ANDROID + +#ifdef ANDROID const RawProps rawProps; - #endif +#endif }; } // namespace react diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index 67ee0b1d8cd..853cfc20cc0 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -145,6 +145,7 @@ void ShadowNode::cloneChildrenIfShared() { #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string ShadowNode::getDebugName() const { return getComponentName(); } @@ -173,6 +174,7 @@ SharedDebugStringConvertibleList ShadowNode::getDebugProps() const { debugStringConvertibleItem("tag", folly::to(tag_)) }; } +#endif } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ReactCommon/fabric/core/shadownode/ShadowNode.h index 573553292f5..a93cd0b4321 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.h @@ -63,6 +63,8 @@ public: const ShadowNodeFragment &fragment ); + virtual ~ShadowNode() = default; + /* * Clones the shadow node using stored `cloneFunction`. */ @@ -103,10 +105,12 @@ public: #pragma mark - DebugStringConvertible +#if RN_DEBUG_STRING_CONVERTIBLE std::string getDebugName() const override; std::string getDebugValue() const override; SharedDebugStringConvertibleList getDebugChildren() const override; SharedDebugStringConvertibleList getDebugProps() const override; +#endif protected: Tag tag_; diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.cpp b/ReactCommon/fabric/debug/DebugStringConvertible.cpp index acf416bddcd..3deadc22608 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertible.cpp +++ b/ReactCommon/fabric/debug/DebugStringConvertible.cpp @@ -10,6 +10,8 @@ namespace facebook { namespace react { +#if RN_DEBUG_STRING_CONVERTIBLE + std::string DebugStringConvertible::getDebugChildrenDescription(DebugStringConvertibleOptions options, int depth) const { if (depth >= options.maximumDepth) { return ""; @@ -86,5 +88,7 @@ SharedDebugStringConvertibleList DebugStringConvertible::getDebugProps() const { return SharedDebugStringConvertibleList(); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.h b/ReactCommon/fabric/debug/DebugStringConvertible.h index 7180b74f78e..dffd501986e 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertible.h +++ b/ReactCommon/fabric/debug/DebugStringConvertible.h @@ -14,6 +14,12 @@ namespace facebook { namespace react { +#ifndef NDEBUG +#define RN_DEBUG_STRING_CONVERTIBLE 1 +#endif + +#if RN_DEBUG_STRING_CONVERTIBLE + class DebugStringConvertible; using SharedDebugStringConvertible = std::shared_ptr; @@ -28,7 +34,6 @@ struct DebugStringConvertibleOptions { // and implements basic recursive debug string assembly algorithm. // Use this as a base class for providing a debugging textual representation // of your class. -// TODO (#26770211): Clear up the naming. class DebugStringConvertible { public: @@ -63,5 +68,11 @@ public: virtual std::string getDebugChildrenDescription(DebugStringConvertibleOptions options = {}, int depth = 0) const; }; +#else + +class DebugStringConvertible {}; + +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp b/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp index 1bbc15002fe..9b686eefbe2 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp +++ b/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp @@ -10,6 +10,8 @@ namespace facebook { namespace react { +#if RN_DEBUG_STRING_CONVERTIBLE + DebugStringConvertibleItem::DebugStringConvertibleItem( const std::string &name, const std::string &value, @@ -37,5 +39,7 @@ SharedDebugStringConvertibleList DebugStringConvertibleItem::getDebugChildren() return children_; } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/debug/DebugStringConvertibleItem.h b/ReactCommon/fabric/debug/DebugStringConvertibleItem.h index 64fdaf45ede..6680683d364 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertibleItem.h +++ b/ReactCommon/fabric/debug/DebugStringConvertibleItem.h @@ -14,6 +14,8 @@ namespace facebook { namespace react { +#if RN_DEBUG_STRING_CONVERTIBLE + // Trivial implementation of `DebugStringConvertible` abstract class // with a stored output; useful for assembling `DebugStringConvertible` values // in custom implementations of `getDebugChildren` and `getDebugProps`. @@ -43,5 +45,7 @@ private: SharedDebugStringConvertibleList children_; }; +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h b/ReactCommon/fabric/debug/debugStringConvertibleUtils.h index 354f15a0d56..d82f079175c 100644 --- a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h +++ b/ReactCommon/fabric/debug/debugStringConvertibleUtils.h @@ -20,6 +20,8 @@ namespace facebook { namespace react { +#if RN_DEBUG_STRING_CONVERTIBLE + inline std::string toString(const std::string &value) { return value; } inline std::string toString(const int &value) { return folly::to(value); } inline std::string toString(const bool &value) { return folly::to(value); } @@ -55,5 +57,7 @@ inline SharedDebugStringConvertible debugStringConvertibleItem(std::string name, return debugStringConvertibleItem(name, value.getDebugDescription(), defaultValue); } +#endif + } // namespace react } // namespace facebook diff --git a/ReactCommon/fabric/uimanager/FabricUIManager.cpp b/ReactCommon/fabric/uimanager/FabricUIManager.cpp index 6bc96f956a6..e24a241ee64 100644 --- a/ReactCommon/fabric/uimanager/FabricUIManager.cpp +++ b/ReactCommon/fabric/uimanager/FabricUIManager.cpp @@ -21,9 +21,6 @@ namespace facebook { namespace react { -// TODO: Kill this flag and remove debug logging. -const bool isLoggingEnabled = false; - static const RawProps rawPropsFromDynamic(const folly::dynamic object) { // TODO: Convert this to something smarter, probably returning `std::iterator`. RawProps result; @@ -174,8 +171,6 @@ void FabricUIManager::stopSurface(SurfaceId surfaceId) const { } SharedShadowNode FabricUIManager::createNode(int tag, std::string viewName, int rootTag, folly::dynamic props, SharedEventTarget eventTarget) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::createNode(tag: " << tag << ", name: " << viewName << ", rootTag: " << rootTag << ", props: " << props << ")"; - ComponentName componentName = componentNameByReactViewName(viewName); const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[componentName]; RawProps rawProps = rawPropsFromDynamic(props); @@ -188,8 +183,6 @@ SharedShadowNode FabricUIManager::createNode(int tag, std::string viewName, int .props = componentDescriptor->cloneProps(nullptr, rawProps) }); - isLoggingEnabled && LOG(INFO) << "FabricUIManager::createNode() -> " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}); - if (delegate_) { delegate_->uiManagerDidCreateShadowNode(shadowNode); } @@ -198,18 +191,15 @@ SharedShadowNode FabricUIManager::createNode(int tag, std::string viewName, int } SharedShadowNode FabricUIManager::cloneNode(const SharedShadowNode &shadowNode) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNode(shadowNode: " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ")"; const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[shadowNode]; SharedShadowNode clonedShadowNode = componentDescriptor->cloneShadowNode(*shadowNode, {}); - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNode() -> " << clonedShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}); return clonedShadowNode; } SharedShadowNode FabricUIManager::cloneNodeWithNewChildren(const SharedShadowNode &shadowNode) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewChildren(shadowNode: " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ")"; // Assuming semantic: Cloning with same props but empty children. const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[shadowNode]; @@ -221,12 +211,10 @@ SharedShadowNode FabricUIManager::cloneNodeWithNewChildren(const SharedShadowNod } ); - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewChildren() -> " << clonedShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}); return clonedShadowNode; } SharedShadowNode FabricUIManager::cloneNodeWithNewProps(const SharedShadowNode &shadowNode, folly::dynamic props) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewProps(shadowNode: " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ", props: " << props << ")"; // Assuming semantic: Cloning with same children and specified props. const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[shadowNode]; RawProps rawProps = rawPropsFromDynamic(props); @@ -239,12 +227,10 @@ SharedShadowNode FabricUIManager::cloneNodeWithNewProps(const SharedShadowNode & } ); - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewProps() -> " << clonedShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}); return clonedShadowNode; } SharedShadowNode FabricUIManager::cloneNodeWithNewChildrenAndProps(const SharedShadowNode &shadowNode, folly::dynamic props) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewChildrenAndProps(shadowNode: " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ", props: " << props << ")"; // Assuming semantic: Cloning with empty children and specified props. const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[shadowNode]; RawProps rawProps = rawPropsFromDynamic(props); @@ -258,37 +244,29 @@ SharedShadowNode FabricUIManager::cloneNodeWithNewChildrenAndProps(const SharedS } ); - isLoggingEnabled && LOG(INFO) << "FabricUIManager::cloneNodeWithNewChildrenAndProps() -> " << clonedShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}); return clonedShadowNode; } void FabricUIManager::appendChild(const SharedShadowNode &parentShadowNode, const SharedShadowNode &childShadowNode) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::appendChild(parentShadowNode: " << parentShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ", childShadowNode: " << childShadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ")"; const SharedComponentDescriptor &componentDescriptor = (*componentDescriptorRegistry_)[parentShadowNode]; componentDescriptor->appendChild(parentShadowNode, childShadowNode); } SharedShadowNodeUnsharedList FabricUIManager::createChildSet(int rootTag) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::createChildSet(rootTag: " << rootTag << ")"; return std::make_shared(SharedShadowNodeList({})); } void FabricUIManager::appendChildToSet(const SharedShadowNodeUnsharedList &shadowNodeList, const SharedShadowNode &shadowNode) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::appendChildToSet(shadowNodeList: " << shadowNodeList << ", shadowNode: " << shadowNode->getDebugDescription(DebugStringConvertibleOptions {.format = false}) << ")"; shadowNodeList->push_back(shadowNode); } void FabricUIManager::completeRoot(int rootTag, const SharedShadowNodeUnsharedList &children) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::completeRoot(rootTag: " << rootTag << ", shadowNodeList: " << children << ")"; - if (delegate_) { delegate_->uiManagerDidFinishTransaction(rootTag, children); } } void FabricUIManager::registerEventHandler(UniqueEventHandler eventHandler) const { - isLoggingEnabled && LOG(INFO) << "FabricUIManager::registerEventHandler(eventHandler: " << eventHandler.get() << ")"; - // Technically, it should be protected by a mutex but regularly it should // be safe because it used only during initialization process. eventHandler_ = std::move(eventHandler);