Publish two events for measure callbacks
Summary: Publishing two events will allow us to replace marker functionality completely with events. This also allows us to remove measuring time spent from Yoga itself. Reviewed By: SidharthGuglani Differential Revision: D16049810 fbshipit-source-id: 98628a92ed3c94d479e9fbcd53fac90c5f524087
This commit is contained in:
committed by
Facebook Github Bot
parent
2c6a4485f5
commit
73224c62b5
@@ -134,10 +134,9 @@ void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
|
|||||||
events.push_back(createArgs<Event::NodeLayout>(node, data));
|
events.push_back(createArgs<Event::NodeLayout>(node, data));
|
||||||
break;
|
break;
|
||||||
case Event::LayoutPassStart:
|
case Event::LayoutPassStart:
|
||||||
break;
|
|
||||||
case Event::LayoutPassEnd:
|
case Event::LayoutPassEnd:
|
||||||
break;
|
case Event::MeasureCallbackStart:
|
||||||
case Event::NodeMeasure:
|
case Event::MeasureCallbackEnd:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1642,6 +1642,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
} else {
|
} else {
|
||||||
#ifdef YG_ENABLE_EVENTS
|
#ifdef YG_ENABLE_EVENTS
|
||||||
auto start = steady_clock::now();
|
auto start = steady_clock::now();
|
||||||
|
Event::publish<Event::MeasureCallbackStart>(node);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Measure the text under the current constraints.
|
// Measure the text under the current constraints.
|
||||||
@@ -1661,7 +1662,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
auto measureCallbackDuration =
|
auto measureCallbackDuration =
|
||||||
duration_cast<std::chrono::duration<float, std::milli>>(end - start);
|
duration_cast<std::chrono::duration<float, std::milli>>(end - start);
|
||||||
|
|
||||||
Event::publish<Event::NodeMeasure>(
|
Event::publish<Event::MeasureCallbackEnd>(
|
||||||
node,
|
node,
|
||||||
{layoutContext,
|
{layoutContext,
|
||||||
innerWidth,
|
innerWidth,
|
||||||
|
@@ -31,7 +31,8 @@ struct Event {
|
|||||||
NodeLayout,
|
NodeLayout,
|
||||||
LayoutPassStart,
|
LayoutPassStart,
|
||||||
LayoutPassEnd,
|
LayoutPassEnd,
|
||||||
NodeMeasure,
|
MeasureCallbackStart,
|
||||||
|
MeasureCallbackEnd,
|
||||||
};
|
};
|
||||||
class Data;
|
class Data;
|
||||||
using Subscriber = void(const YGNode&, Type, Data);
|
using Subscriber = void(const YGNode&, Type, Data);
|
||||||
@@ -93,7 +94,7 @@ struct Event::TypedData<Event::LayoutPassEnd> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct Event::TypedData<Event::NodeMeasure> {
|
struct Event::TypedData<Event::MeasureCallbackEnd> {
|
||||||
void* layoutContext;
|
void* layoutContext;
|
||||||
float width;
|
float width;
|
||||||
YGMeasureMode widthMeasureMode;
|
YGMeasureMode widthMeasureMode;
|
||||||
|
Reference in New Issue
Block a user