Adapt micro benchmark

Summary:
- adds more property assignments
- reduces the number of layout roots that exist simultanously

Reviewed By: pasqualeanatriello

Differential Revision: D8989389

fbshipit-source-id: 6a0ac800a4caad61a2f4bf98caa314855b70875f
This commit is contained in:
David Aurelio
2018-08-02 03:50:15 -07:00
committed by Facebook Github Bot
parent 292bfed102
commit 0e99980206
2 changed files with 12 additions and 13 deletions

View File

@@ -96,7 +96,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
public void addChildAt(YogaNode child, int i) {
if (child.mOwner != null) {
throw new IllegalStateException("Child already has a parent, it must be removed first.");
@@ -172,7 +171,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
public YogaNode removeChildAt(int i) {
if (mChildren == null) {
throw new IllegalStateException(
@@ -185,9 +183,11 @@ public class YogaNode implements Cloneable {
}
/**
* @returns the {@link YogaNode} that owns this {@link YogaNode}. The owner is used to identify
* the YogaTree that a {@link YogaNode} belongs to. This method will return the parent of the
* {@link YogaNode} when the {@link YogaNode} only belongs to one YogaTree or null when the
* @returns the {@link YogaNode} that owns this {@link YogaNode}.
* The owner is used to identify the YogaTree that a {@link YogaNode} belongs
* to.
* This method will return the parent of the {@link YogaNode} when the
* {@link YogaNode} only belongs to one YogaTree or null when the
* {@link YogaNode} is shared between two or more YogaTrees.
*/
@Nullable
@@ -218,7 +218,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeMarkDirty(long nativePointer);
public void dirty() {
jni_YGNodeMarkDirty(getNativePointer());
}
@@ -234,7 +233,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
public void copyStyle(YogaNode srcNode) {
jni_YGNodeCopyStyle(getNativePointer(), srcNode.getNativePointer());
}
@@ -528,7 +526,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
mMeasureFunction = measureFunction;
jni_YGNodeSetHasMeasureFunc(getNativePointer(), measureFunction != null);
@@ -554,7 +551,6 @@ public class YogaNode implements Cloneable {
}
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
mBaselineFunction = baselineFunction;
jni_YGNodeSetHasBaselineFunc(getNativePointer(), baselineFunction != null);
@@ -580,8 +576,8 @@ public class YogaNode implements Cloneable {
private native void jni_YGNodePrint(long nativePointer);
/**
* Use the set logger (defaults to adb log) to print out the styles, children, and computed layout
* of the tree rooted at this node.
* Use the set logger (defaults to adb log) to print out the styles, children, and computed
* layout of the tree rooted at this node.
*/
public void print() {
jni_YGNodePrint(getNativePointer());

View File

@@ -385,6 +385,9 @@ jlong jni_YGNodeCloneNoProps(
}
void jni_YGNodeFree(alias_ref<jobject> thiz, jlong nativePointer) {
if (nativePointer == 0) {
return;
}
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
delete reinterpret_cast<JNINodeContext*>(node->getContext());
YGNodeFree(node);