Add YogaNodeProperties implementation with ByteBuffer based setters

Summary:
@public
Adds an implementation of `YogaNodeProperties` that sets style properties using a `ByteBuffer` rather than JNI calls.
We hope for a speed improvement.

Reviewed By: pasqualeanatriello

Differential Revision: D9042225

fbshipit-source-id: c7f2b24eaeddd1190755bec85a5034079bd2f492
This commit is contained in:
David Aurelio
2018-07-30 09:30:54 -07:00
committed by Facebook Github Bot
parent 3499e2e0ef
commit 78d6988461
5 changed files with 347 additions and 38 deletions

View File

@@ -33,6 +33,12 @@ struct JYogaNodePropertiesByteBuffer
"Lcom/facebook/yoga/YogaNodePropertiesByteBuffer";
};
struct JYogaNodePropertiesHybrid
: public JavaClass<JYogaNodePropertiesHybrid, JYogaNodePropertiesJNI> {
static constexpr auto kJavaDescriptor =
"Lcom/facebook/yoga/YogaNodePropertiesHybrid";
};
struct YGConfigContext {
global_ref<jobject>* logger;
global_ref<jobject>* config;
@@ -858,5 +864,10 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
YGMakeNativeMethod(jni_getStyleBuffer),
YGMakeNativeMethod(jni_getLayoutBuffer),
});
registerNatives(
"com/facebook/yoga/YogaNodePropertiesHybrid",
{
YGMakeNativeMethod(jni_getStyleBuffer),
});
});
}