Add exception handling in vanilla jni
Summary: Exception handling in vanilla jni ## Changelog: [Internal] [Added] Added exception handling for vanilla jni implementation in yoga Reviewed By: amir-shalem Differential Revision: D18036134 fbshipit-source-id: 965eaa2fddbc00b9ac0120b79678608e280d03db
This commit is contained in:
committed by
Facebook Github Bot
parent
42bba10894
commit
688bd4ef72
@@ -352,25 +352,29 @@ static void jni_YGNodeCalculateLayoutJNI(
|
||||
jlongArray nativePointers,
|
||||
jobjectArray javaNodes) {
|
||||
|
||||
void* layoutContext = nullptr;
|
||||
auto map = PtrJNodeMapVanilla{};
|
||||
if (nativePointers) {
|
||||
size_t nativePointersSize = env->GetArrayLength(nativePointers);
|
||||
jlong result[nativePointersSize];
|
||||
env->GetLongArrayRegion(nativePointers, 0, nativePointersSize, result);
|
||||
try {
|
||||
void* layoutContext = nullptr;
|
||||
auto map = PtrJNodeMapVanilla{};
|
||||
if (nativePointers) {
|
||||
size_t nativePointersSize = env->GetArrayLength(nativePointers);
|
||||
jlong result[nativePointersSize];
|
||||
env->GetLongArrayRegion(nativePointers, 0, nativePointersSize, result);
|
||||
|
||||
map = PtrJNodeMapVanilla{result, nativePointersSize, javaNodes};
|
||||
layoutContext = ↦
|
||||
map = PtrJNodeMapVanilla{result, nativePointersSize, javaNodes};
|
||||
layoutContext = ↦
|
||||
}
|
||||
|
||||
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
||||
YGNodeCalculateLayoutWithContext(
|
||||
root,
|
||||
static_cast<float>(width),
|
||||
static_cast<float>(height),
|
||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)),
|
||||
layoutContext);
|
||||
YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext);
|
||||
} catch (jthrowable throwable) {
|
||||
env->Throw(throwable);
|
||||
}
|
||||
|
||||
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
||||
YGNodeCalculateLayoutWithContext(
|
||||
root,
|
||||
static_cast<float>(width),
|
||||
static_cast<float>(height),
|
||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)),
|
||||
layoutContext);
|
||||
YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext);
|
||||
}
|
||||
|
||||
static void jni_YGNodeMarkDirtyJNI(
|
||||
|
Reference in New Issue
Block a user