Add Unsafe
based storage backend
Summary: @public Adds another version of property storage for `YogaNode`, using `sun.misc.Unsafe`. Adopts the stub concept from Litho for `Unsafe`, as it is hidden by the Android SDK. Reviewed By: pasqualeanatriello Differential Revision: D9140103 fbshipit-source-id: a4b376eca341b724a00f873467ae8bf8eaac69f4
This commit is contained in:
committed by
Facebook Github Bot
parent
c5d4485db3
commit
be78bfbd8c
@@ -344,13 +344,11 @@ jlong jni_YGNodeNewWithConfig(
|
||||
return reinterpret_cast<jlong>(node);
|
||||
}
|
||||
|
||||
jlong jni_YGNodeNewByteBuffer(
|
||||
alias_ref<jclass>,
|
||||
alias_ref<JYogaNode> javaNode) {
|
||||
jlong jni_YGNodeNewNoProps(alias_ref<jclass>, alias_ref<JYogaNode> javaNode) {
|
||||
return jni_YGNodeNew(nullptr, javaNode);
|
||||
}
|
||||
|
||||
jlong jni_YGNodeNewByteBufferWithConfig(
|
||||
jlong jni_YGNodeNewNoPropsWithConfig(
|
||||
alias_ref<jclass>,
|
||||
alias_ref<JYogaNode> javaNode,
|
||||
jlong configPointer) {
|
||||
@@ -747,6 +745,14 @@ local_ref<JByteBuffer> jni_getLayoutBuffer(
|
||||
reinterpret_cast<uint8_t*>(layout), sizeof(YGLayout));
|
||||
}
|
||||
|
||||
jlong jni_YGNodeStylePointer(alias_ref<jclass>, jlong nativePointer) {
|
||||
return reinterpret_cast<jlong>(&_jlong2YGNodeRef(nativePointer)->getStyle());
|
||||
}
|
||||
|
||||
jlong jni_YGNodeLayoutPointer(alias_ref<jclass>, jlong nativePointer) {
|
||||
return reinterpret_cast<jlong>(&_jlong2YGNodeRef(nativePointer)->getLayout());
|
||||
}
|
||||
|
||||
#define YGMakeNativeMethod(name) makeNativeMethod(#name, name)
|
||||
|
||||
jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
@@ -860,8 +866,8 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
{
|
||||
YGMakeNativeMethod(jni_YGNodeCloneNoProps),
|
||||
YGMakeNativeMethod(jni_YGNodeFree),
|
||||
YGMakeNativeMethod(jni_YGNodeNewByteBuffer),
|
||||
YGMakeNativeMethod(jni_YGNodeNewByteBufferWithConfig),
|
||||
YGMakeNativeMethod(jni_YGNodeNewNoProps),
|
||||
YGMakeNativeMethod(jni_YGNodeNewNoPropsWithConfig),
|
||||
YGMakeNativeMethod(jni_YGNodeReset),
|
||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||
YGMakeNativeMethod(jni_getStyleBuffer),
|
||||
@@ -872,5 +878,17 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
{
|
||||
YGMakeNativeMethod(jni_getStyleBuffer),
|
||||
});
|
||||
registerNatives(
|
||||
"com/facebook/yoga/YogaNodePropertiesUnsafe",
|
||||
{
|
||||
YGMakeNativeMethod(jni_YGNodeCloneNoProps),
|
||||
YGMakeNativeMethod(jni_YGNodeFree),
|
||||
YGMakeNativeMethod(jni_YGNodeNewNoProps),
|
||||
YGMakeNativeMethod(jni_YGNodeNewNoPropsWithConfig),
|
||||
YGMakeNativeMethod(jni_YGNodeStylePointer),
|
||||
YGMakeNativeMethod(jni_YGNodeLayoutPointer),
|
||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||
YGMakeNativeMethod(jni_YGNodeReset),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user