Skip to content

Commit 2985ddb

Browse files
davidaureliofacebook-github-bot
authored andcommitted
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
1 parent 9a84970 commit 2985ddb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ReactCommon/yoga/yoga/Yoga.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
16421642
} else {
16431643
#ifdef YG_ENABLE_EVENTS
16441644
auto start = steady_clock::now();
1645+
Event::publish<Event::MeasureCallbackStart>(node);
16451646
#endif
16461647

16471648
// Measure the text under the current constraints.
@@ -1661,7 +1662,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
16611662
auto measureCallbackDuration =
16621663
duration_cast<std::chrono::duration<float, std::milli>>(end - start);
16631664

1664-
Event::publish<Event::NodeMeasure>(
1665+
Event::publish<Event::MeasureCallbackEnd>(
16651666
node,
16661667
{layoutContext,
16671668
innerWidth,

ReactCommon/yoga/yoga/event/event.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ struct Event {
3131
NodeLayout,
3232
LayoutPassStart,
3333
LayoutPassEnd,
34-
NodeMeasure,
34+
MeasureCallbackStart,
35+
MeasureCallbackEnd,
3536
};
3637
class Data;
3738
using Subscriber = void(const YGNode&, Type, Data);
@@ -93,7 +94,7 @@ struct Event::TypedData<Event::LayoutPassEnd> {
9394
};
9495

9596
template <>
96-
struct Event::TypedData<Event::NodeMeasure> {
97+
struct Event::TypedData<Event::MeasureCallbackEnd> {
9798
void* layoutContext;
9899
float width;
99100
YGMeasureMode widthMeasureMode;

0 commit comments

Comments
 (0)