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 maxMeasureCache;
|
||||||
int cachedLayouts;
|
int cachedLayouts;
|
||||||
int cachedMeasures;
|
int cachedMeasures;
|
||||||
|
int measureCallbacks;
|
||||||
} YGMarkerLayoutData;
|
} YGMarkerLayoutData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -1581,6 +1581,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
const YGMeasureMode heightMeasureMode,
|
const YGMeasureMode heightMeasureMode,
|
||||||
const float ownerWidth,
|
const float ownerWidth,
|
||||||
const float ownerHeight,
|
const float ownerHeight,
|
||||||
|
YGMarkerLayoutData& layoutMarkerData,
|
||||||
void* const layoutContext) {
|
void* const layoutContext) {
|
||||||
YGAssertWithNode(
|
YGAssertWithNode(
|
||||||
node,
|
node,
|
||||||
@@ -1634,6 +1635,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
innerHeight,
|
innerHeight,
|
||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
layoutContext);
|
layoutContext);
|
||||||
|
layoutMarkerData.measureCallbacks += 1;
|
||||||
|
|
||||||
#ifdef YG_ENABLE_EVENTS
|
#ifdef YG_ENABLE_EVENTS
|
||||||
Event::publish<Event::NodeMeasure>(
|
Event::publish<Event::NodeMeasure>(
|
||||||
@@ -2700,6 +2702,7 @@ static void YGNodelayoutImpl(
|
|||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
ownerWidth,
|
ownerWidth,
|
||||||
ownerHeight,
|
ownerHeight,
|
||||||
|
layoutMarkerData,
|
||||||
layoutContext);
|
layoutContext);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4101,13 +4104,13 @@ void YGNodeCalculateLayoutWithContext(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef YG_ENABLE_EVENTS
|
||||||
|
Event::publish<Event::LayoutPassEnd>(node, {layoutContext, &marker->data});
|
||||||
|
#endif
|
||||||
|
|
||||||
// end marker here
|
// end marker here
|
||||||
marker = nullptr;
|
marker = nullptr;
|
||||||
|
|
||||||
#ifdef YG_ENABLE_EVENTS
|
|
||||||
Event::publish<Event::LayoutPassEnd>(node, {layoutContext});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we
|
// 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.
|
// 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
|
// So logging this in YGLayout would help to find out the call sites depending
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../YGEnums.h"
|
#include "../YGEnums.h"
|
||||||
|
#include "../YGMarker.h"
|
||||||
|
|
||||||
struct YGConfig;
|
struct YGConfig;
|
||||||
struct YGNode;
|
struct YGNode;
|
||||||
@@ -81,6 +82,7 @@ struct Event::TypedData<Event::LayoutPassStart> {
|
|||||||
template <>
|
template <>
|
||||||
struct Event::TypedData<Event::LayoutPassEnd> {
|
struct Event::TypedData<Event::LayoutPassEnd> {
|
||||||
void* layoutContext;
|
void* layoutContext;
|
||||||
|
YGMarkerLayoutData* layoutData;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
Reference in New Issue
Block a user