Prevent GC delegates
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Facebook.Yoga
|
|||||||
|
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
|
|
||||||
|
public static Func _loggerInternal = LoggerInternal;
|
||||||
public static Func Logger = null;
|
public static Func Logger = null;
|
||||||
|
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
@@ -45,7 +46,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
if (!_initialized)
|
if (!_initialized)
|
||||||
{
|
{
|
||||||
Native.YGInteropSetLogger(LoggerInternal);
|
Native.YGInteropSetLogger(_loggerInternal);
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,13 @@ namespace Facebook.Yoga
|
|||||||
private MeasureFunction _measureFunction;
|
private MeasureFunction _measureFunction;
|
||||||
private BaselineFunction _baselineFunction;
|
private BaselineFunction _baselineFunction;
|
||||||
private object _data;
|
private object _data;
|
||||||
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
|
private static YogaMeasureFunc _measureInternalIOS = MeasureInternalIOS;
|
||||||
|
private static YogaBaselineFunc _baselineInternalIOS = BaselineInternalIOS;
|
||||||
|
#else
|
||||||
|
private YogaMeasureFunc _measureInternal;
|
||||||
|
private YogaBaselineFunc _baselineInternal;
|
||||||
|
#endif
|
||||||
|
|
||||||
public YogaNode()
|
public YogaNode()
|
||||||
{
|
{
|
||||||
@@ -555,9 +562,10 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
_ygNode.SetContext(this);
|
_ygNode.SetContext(this);
|
||||||
func = MeasureInternalIOS;
|
func = _measureInternalIOS;
|
||||||
#else
|
#else
|
||||||
func = MeasureInternal;
|
_measureInternal = MeasureInternal;
|
||||||
|
func = _measureInternal;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Native.YGNodeSetMeasureFunc(_ygNode, func);
|
Native.YGNodeSetMeasureFunc(_ygNode, func);
|
||||||
@@ -571,9 +579,10 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
_ygNode.SetContext(this);
|
_ygNode.SetContext(this);
|
||||||
func = BaselineInternalIOS;
|
func = _baselineInternalIOS;
|
||||||
#else
|
#else
|
||||||
func = BaselineInternal;
|
_baselineInternal = BaselineInternal;
|
||||||
|
func = _baselineInternal;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Native.YGNodeSetBaselineFunc(_ygNode, func);
|
Native.YGNodeSetBaselineFunc(_ygNode, func);
|
||||||
|
Reference in New Issue
Block a user