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:
committed by
Facebook Github Bot
parent
21f814b2a6
commit
9100019c0a
30
java/com/facebook/yoga/YogaConfigJNIFinalizer.java
Normal file
30
java/com/facebook/yoga/YogaConfigJNIFinalizer.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user