10
10
#include < functional>
11
11
#include < memory>
12
12
13
+ #include < cxxreact/SystraceSection.h>
13
14
#include < react/debug/react_native_assert.h>
14
15
#include < react/renderer/core/ComponentDescriptor.h>
15
16
#include < react/renderer/core/EventDispatcher.h>
@@ -66,6 +67,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
66
67
std::shared_ptr<ShadowNode> createShadowNode (
67
68
const ShadowNodeFragment& fragment,
68
69
const ShadowNodeFamily::Shared& family) const override {
70
+ SystraceSection s (" ConcreteComponentDescriptor::createShadowNode" );
69
71
auto shadowNode =
70
72
std::make_shared<ShadowNodeT>(fragment, family, getTraits ());
71
73
@@ -97,6 +99,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
97
99
const PropsParserContext& context,
98
100
const Props::Shared& props,
99
101
RawProps rawProps) const override {
102
+ SystraceSection s1 (" ConcreteComponentDescriptor::cloneProps" );
100
103
// Optimization:
101
104
// Quite often nodes are constructed with default/empty props: the base
102
105
// `props` object is `null` (there no base because it's not cloning) and the
@@ -112,21 +115,23 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
112
115
113
116
rawProps.parse (rawPropsParser_);
114
117
115
- // Call old-style constructor
116
- auto shadowNodeProps = ShadowNodeT::Props (context, rawProps, props);
117
-
118
118
// Use the new-style iterator
119
119
// Note that we just check if `Props` has this flag set, no matter
120
120
// the type of ShadowNode; it acts as the single global flag.
121
121
if (CoreFeatures::enablePropIteratorSetter) {
122
+ auto shadowNodeProps = ShadowNodeT::Props (context, rawProps, props);
122
123
rawProps.iterateOverValues ([&](RawPropsPropNameHash hash,
123
124
const char * propName,
124
125
const RawValue& fn) {
125
126
shadowNodeProps.get ()->setProp (context, hash, propName, fn);
126
127
});
128
+ return shadowNodeProps;
129
+ } else {
130
+ SystraceSection s2 (
131
+ " ConcreteComponentDescriptor::cloneProps - old-style constructor" );
132
+ // Call old-style constructor
133
+ return ShadowNodeT::Props (context, rawProps, props);
127
134
}
128
-
129
- return shadowNodeProps;
130
135
};
131
136
132
137
virtual State::Shared createInitialState (
@@ -160,6 +165,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
160
165
161
166
ShadowNodeFamily::Shared createFamily (
162
167
const ShadowNodeFamilyFragment& fragment) const override {
168
+ SystraceSection s (" ConcreteComponentDescriptor::createFamily" );
163
169
auto eventEmitter = std::make_shared<const ConcreteEventEmitter>(
164
170
std::make_shared<EventTarget>(fragment.instanceHandle ),
165
171
eventDispatcher_);
0 commit comments