Split YogaConfig into interface and actual implementation

Summary:
Split YogaConfig into the same way YogaNode is split today.

Into an abstract class defining the interface, and actual JNI implementation

Reviewed By: SidharthGuglani

Differential Revision: D17266404

fbshipit-source-id: 3d5d6aa65c55cfa61d47c662d140cdce6dcb0ea1
This commit is contained in:
Amir Shalem
2019-09-18 00:36:26 -07:00
committed by Facebook Github Bot
parent 21f814b2a6
commit 9100019c0a
4 changed files with 118 additions and 55 deletions

View File

@@ -0,0 +1,30 @@
/**
* 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;
public class YogaConfigJNIFinalizer extends YogaConfigJNIBase {
public YogaConfigJNIFinalizer() {
super();
}
@Override
protected void finalize() throws Throwable {
try {
freeNatives();
} finally {
super.finalize();
}
}
public void freeNatives() {
if (mNativePointer != 0) {
long nativePointer = mNativePointer;
mNativePointer = 0;
YogaNative.jni_YGConfigFree(nativePointer);
}
}
}