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:
committed by
Facebook Github Bot
parent
292bfed102
commit
0e99980206
@@ -18,7 +18,7 @@ import javax.annotation.Nullable;
|
|||||||
public class YogaNode implements Cloneable {
|
public class YogaNode implements Cloneable {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SoLoader.loadLibrary("yoga");
|
SoLoader.loadLibrary("yoga");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int BYTE_BUFFER = 1;
|
public static final int BYTE_BUFFER = 1;
|
||||||
@@ -96,7 +96,6 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||||
|
|
||||||
public void addChildAt(YogaNode child, int i) {
|
public void addChildAt(YogaNode child, int i) {
|
||||||
if (child.mOwner != null) {
|
if (child.mOwner != null) {
|
||||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
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);
|
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
||||||
|
|
||||||
public YogaNode removeChildAt(int i) {
|
public YogaNode removeChildAt(int i) {
|
||||||
if (mChildren == null) {
|
if (mChildren == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
@@ -185,10 +183,12 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the {@link YogaNode} that owns this {@link YogaNode}. The owner is used to identify
|
* @returns the {@link YogaNode} that owns this {@link YogaNode}.
|
||||||
* the YogaTree that a {@link YogaNode} belongs to. This method will return the parent of the
|
* The owner is used to identify the YogaTree that a {@link YogaNode} belongs
|
||||||
* {@link YogaNode} when the {@link YogaNode} only belongs to one YogaTree or null when the
|
* to.
|
||||||
* {@link YogaNode} is shared between two or more YogaTrees.
|
* 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
|
@Nullable
|
||||||
public YogaNode getOwner() {
|
public YogaNode getOwner() {
|
||||||
@@ -218,7 +218,6 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeMarkDirty(long nativePointer);
|
private native void jni_YGNodeMarkDirty(long nativePointer);
|
||||||
|
|
||||||
public void dirty() {
|
public void dirty() {
|
||||||
jni_YGNodeMarkDirty(getNativePointer());
|
jni_YGNodeMarkDirty(getNativePointer());
|
||||||
}
|
}
|
||||||
@@ -234,7 +233,6 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||||
|
|
||||||
public void copyStyle(YogaNode srcNode) {
|
public void copyStyle(YogaNode srcNode) {
|
||||||
jni_YGNodeCopyStyle(getNativePointer(), srcNode.getNativePointer());
|
jni_YGNodeCopyStyle(getNativePointer(), srcNode.getNativePointer());
|
||||||
}
|
}
|
||||||
@@ -528,7 +526,6 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
|
|
||||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||||
mMeasureFunction = measureFunction;
|
mMeasureFunction = measureFunction;
|
||||||
jni_YGNodeSetHasMeasureFunc(getNativePointer(), measureFunction != null);
|
jni_YGNodeSetHasMeasureFunc(getNativePointer(), measureFunction != null);
|
||||||
@@ -554,7 +551,6 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
|
|
||||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||||
mBaselineFunction = baselineFunction;
|
mBaselineFunction = baselineFunction;
|
||||||
jni_YGNodeSetHasBaselineFunc(getNativePointer(), baselineFunction != null);
|
jni_YGNodeSetHasBaselineFunc(getNativePointer(), baselineFunction != null);
|
||||||
@@ -580,8 +576,8 @@ public class YogaNode implements Cloneable {
|
|||||||
private native void jni_YGNodePrint(long nativePointer);
|
private native void jni_YGNodePrint(long nativePointer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the set logger (defaults to adb log) to print out the styles, children, and computed layout
|
* Use the set logger (defaults to adb log) to print out the styles, children, and computed
|
||||||
* of the tree rooted at this node.
|
* layout of the tree rooted at this node.
|
||||||
*/
|
*/
|
||||||
public void print() {
|
public void print() {
|
||||||
jni_YGNodePrint(getNativePointer());
|
jni_YGNodePrint(getNativePointer());
|
||||||
|
@@ -385,6 +385,9 @@ jlong jni_YGNodeCloneNoProps(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void jni_YGNodeFree(alias_ref<jobject> thiz, jlong nativePointer) {
|
void jni_YGNodeFree(alias_ref<jobject> thiz, jlong nativePointer) {
|
||||||
|
if (nativePointer == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||||
delete reinterpret_cast<JNINodeContext*>(node->getContext());
|
delete reinterpret_cast<JNINodeContext*>(node->getContext());
|
||||||
YGNodeFree(node);
|
YGNodeFree(node);
|
||||||
|
Reference in New Issue
Block a user