Delete functionality for shared childen
Summary: @public Removes `YGNodeInsertSharedChild` / `addSharedChildAt`. This functionality is unused, and can cause memory leaks. Reviewed By: SidharthGuglani Differential Revision: D13711105 fbshipit-source-id: 86206c05393b3f1a497e6b046006f94ead88c6ce
This commit is contained in:
parent
9351dd6c69
commit
f4def0062c
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@ -174,17 +173,6 @@ public class YogaNode implements Cloneable {
|
|||
jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index);
|
||||
|
||||
public void addSharedChildAt(YogaNode child, int i) {
|
||||
if (mChildren == null) {
|
||||
mChildren = new ArrayList<>(4);
|
||||
}
|
||||
mChildren.add(i, child);
|
||||
child.mOwner = null;
|
||||
jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
|
||||
|
||||
public void setIsReferenceBaseline(boolean isReferenceBaseline) {
|
||||
|
|
|
@ -359,14 +359,6 @@ void jni_YGNodeInsertChild(
|
|||
_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index);
|
||||
}
|
||||
|
||||
void jni_YGNodeInsertSharedChild(
|
||||
jlong nativePointer,
|
||||
jlong childPointer,
|
||||
jint index) {
|
||||
YGNodeInsertSharedChild(
|
||||
_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index);
|
||||
}
|
||||
|
||||
void jni_YGNodeRemoveChild(jlong nativePointer, jlong childPointer) {
|
||||
YGNodeRemoveChild(
|
||||
_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
||||
|
@ -672,7 +664,6 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
|||
YGMakeCriticalNativeMethod(jni_YGNodeReset),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeClearChildren),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeInsertChild),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeInsertSharedChild),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeRemoveChild),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeSetIsReferenceBaseline),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeIsReferenceBaseline),
|
||||
|
|
|
@ -402,20 +402,6 @@ void YGNodeInsertChild(
|
|||
node->markDirtyAndPropogate();
|
||||
}
|
||||
|
||||
void YGNodeInsertSharedChild(
|
||||
const YGNodeRef node,
|
||||
const YGNodeRef child,
|
||||
const uint32_t index) {
|
||||
YGAssertWithNode(
|
||||
node,
|
||||
node->getMeasure() == nullptr,
|
||||
"Cannot add child: Nodes with measure functions cannot have children.");
|
||||
|
||||
node->insertChild(child, index);
|
||||
child->setOwner(nullptr);
|
||||
node->markDirtyAndPropogate();
|
||||
}
|
||||
|
||||
void YGNodeRemoveChild(const YGNodeRef owner, const YGNodeRef excludedChild) {
|
||||
// This algorithm is a forked variant from cloneChildrenIfNeeded in YGNode
|
||||
// that excludes a child.
|
||||
|
|
|
@ -69,16 +69,6 @@ WIN_EXPORT void YGNodeInsertChild(
|
|||
const YGNodeRef child,
|
||||
const uint32_t index);
|
||||
|
||||
// This function inserts the child YGNodeRef as a children of the node received
|
||||
// by parameter and set the Owner of the child object to null. This function is
|
||||
// expected to be called when using Yoga in persistent mode in order to share a
|
||||
// YGNodeRef object as a child of two different Yoga trees. The child YGNodeRef
|
||||
// is expected to be referenced from its original owner and from a clone of its
|
||||
// original owner.
|
||||
WIN_EXPORT void YGNodeInsertSharedChild(
|
||||
const YGNodeRef node,
|
||||
const YGNodeRef child,
|
||||
const uint32_t index);
|
||||
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
|
||||
WIN_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef node);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
|
||||
|
|
Loading…
Reference in New Issue