Simplify memory model between managed and unmanaged memory

Summary: Instead of having different lifetimes for java and c memory we can can tie them together and make them much easier to manage. This also leads to automatically pooling native memory if pooling java memory.

Differential Revision: D4051454

fbshipit-source-id: 8f5d010be520b3d1c981a7f85e5e6d95773ea6c1
This commit is contained in:
Emil Sjolander
2016-10-24 10:35:41 -07:00
committed by Facebook Github Bot
parent 4c57029a28
commit 69c374e74e
9 changed files with 47 additions and 264 deletions

View File

@@ -59,6 +59,14 @@ void jni_CSSNodeFree(alias_ref<jobject> thiz, jlong nativePointer) {
CSSNodeFree(_jlong2CSSNodeRef(nativePointer));
}
void jni_CSSNodeReset(alias_ref<jobject> thiz, jlong nativePointer) {
const CSSNodeRef node = _jlong2CSSNodeRef(nativePointer);
void *context = CSSNodeGetContext(node);
CSSNodeReset(node);
CSSNodeSetContext(node, context);
CSSNodeSetPrintFunc(node, _jniPrint);
}
void jni_CSSNodeInsertChild(alias_ref<jobject>,
jlong nativePointer,
jlong childPointer,
@@ -179,6 +187,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
{
CSSMakeNativeMethod(jni_CSSNodeNew),
CSSMakeNativeMethod(jni_CSSNodeFree),
CSSMakeNativeMethod(jni_CSSNodeReset),
CSSMakeNativeMethod(jni_CSSNodeInsertChild),
CSSMakeNativeMethod(jni_CSSNodeRemoveChild),
CSSMakeNativeMethod(jni_CSSNodeSetIsTextNode),