Count the number measure callback invocations
Summary: Counts how many times measure callbacks have been invoked during a layout pass. This is made available via the marker and event APIs. Reviewed By: SidharthGuglani Differential Revision: D15836983 fbshipit-source-id: 3835bef94e497375821c9f2ad8209447b4f11518
This commit is contained in:
committed by
Facebook Github Bot
parent
a130ac2f9c
commit
6b5bf570c8
@@ -25,6 +25,7 @@ typedef struct {
|
||||
int maxMeasureCache;
|
||||
int cachedLayouts;
|
||||
int cachedMeasures;
|
||||
int measureCallbacks;
|
||||
} YGMarkerLayoutData;
|
||||
|
||||
typedef struct {
|
||||
|
@@ -1581,6 +1581,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
||||
const YGMeasureMode heightMeasureMode,
|
||||
const float ownerWidth,
|
||||
const float ownerHeight,
|
||||
YGMarkerLayoutData& layoutMarkerData,
|
||||
void* const layoutContext) {
|
||||
YGAssertWithNode(
|
||||
node,
|
||||
@@ -1634,6 +1635,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
||||
innerHeight,
|
||||
heightMeasureMode,
|
||||
layoutContext);
|
||||
layoutMarkerData.measureCallbacks += 1;
|
||||
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::NodeMeasure>(
|
||||
@@ -2700,6 +2702,7 @@ static void YGNodelayoutImpl(
|
||||
heightMeasureMode,
|
||||
ownerWidth,
|
||||
ownerHeight,
|
||||
layoutMarkerData,
|
||||
layoutContext);
|
||||
return;
|
||||
}
|
||||
@@ -4101,13 +4104,13 @@ void YGNodeCalculateLayoutWithContext(
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::LayoutPassEnd>(node, {layoutContext, &marker->data});
|
||||
#endif
|
||||
|
||||
// end marker here
|
||||
marker = nullptr;
|
||||
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::LayoutPassEnd>(node, {layoutContext});
|
||||
#endif
|
||||
|
||||
// We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we
|
||||
// aren't sure whether client's of yoga have gotten rid off this flag or not.
|
||||
// So logging this in YGLayout would help to find out the call sites depending
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include "../YGEnums.h"
|
||||
#include "../YGMarker.h"
|
||||
|
||||
struct YGConfig;
|
||||
struct YGNode;
|
||||
@@ -81,6 +82,7 @@ struct Event::TypedData<Event::LayoutPassStart> {
|
||||
template <>
|
||||
struct Event::TypedData<Event::LayoutPassEnd> {
|
||||
void* layoutContext;
|
||||
YGMarkerLayoutData* layoutData;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
Reference in New Issue
Block a user