Breaking remove YogaNode#clone
Summary: @public The cloning features of YogaNode don’t seem to be used. Let’s remove them. Reviewed By: SidharthGuglani Differential Revision: D14165624 fbshipit-source-id: 5b710964a4abf1b35f3bcc25b143ffc719a03cec
This commit is contained in:
committed by
Facebook Github Bot
parent
47abe1c482
commit
e25fe994b3
@@ -98,16 +98,4 @@ public class YogaConfig {
|
||||
public YogaLogger getLogger() {
|
||||
return mLogger;
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetHasCloneNodeFunc(long nativePointer, boolean hasClonedFunc);
|
||||
|
||||
public void setOnCloneNode(YogaNodeCloneFunction cloneYogaNodeFunction) {
|
||||
mYogaNodeCloneFunction = cloneYogaNodeFunction;
|
||||
jni_YGConfigSetHasCloneNodeFunc(mNativePointer, cloneYogaNodeFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
private final YogaNodeJNI cloneNode(YogaNodeJNI oldNode, YogaNodeJNI parent, int childIndex) {
|
||||
return (YogaNodeJNI) mYogaNodeCloneFunction.cloneNode(oldNode, parent, childIndex);
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNodeJNI extends YogaNode implements Cloneable {
|
||||
public class YogaNodeJNI extends YogaNode {
|
||||
|
||||
static {
|
||||
SoLoader.loadLibrary("yoga");
|
||||
@@ -189,53 +189,6 @@ public class YogaNodeJNI extends YogaNode implements Cloneable {
|
||||
return jni_YGNodeIsReferenceBaseline(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer);
|
||||
|
||||
private native long jni_YGNodeClone(long nativePointer, Object newNode, boolean avoidGlobalJNIRefs);
|
||||
|
||||
@Override
|
||||
public YogaNodeJNI clone() {
|
||||
try {
|
||||
YogaNodeJNI clonedYogaNode = (YogaNodeJNI) super.clone();
|
||||
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode, mAvoidGlobalJNIRefs);
|
||||
|
||||
if (mChildren != null) {
|
||||
for (YogaNodeJNI child : mChildren) {
|
||||
jni_YGNodeSetOwner(child.mNativePointer, 0);
|
||||
child.mOwner = null;
|
||||
}
|
||||
}
|
||||
|
||||
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||
clonedYogaNode.mOwner = null;
|
||||
clonedYogaNode.mChildren =
|
||||
mChildren != null ? (List<YogaNodeJNI>) ((ArrayList) mChildren).clone() : null;
|
||||
if (clonedYogaNode.mChildren != null) {
|
||||
for (YogaNodeJNI child : clonedYogaNode.mChildren) {
|
||||
child.mOwner = null;
|
||||
}
|
||||
}
|
||||
return clonedYogaNode;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
// This class implements Cloneable, this should not happen
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaNodeJNI cloneWithNewChildren() {
|
||||
try {
|
||||
YogaNodeJNI clonedYogaNode = (YogaNodeJNI) super.clone();
|
||||
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode, mAvoidGlobalJNIRefs);
|
||||
clonedYogaNode.mOwner = null;
|
||||
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||
clonedYogaNode.clearChildren();
|
||||
return clonedYogaNode;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
// This class implements Cloneable, this should not happen
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeClearChildren(long nativePointer);
|
||||
|
||||
private void clearChildren() {
|
||||
|
Reference in New Issue
Block a user