Summary: @public Moving all native methods in a single class provides the benefit of not having to load native bindings eagerly when just creating config objects in the startup paths, or setting Java-only values on them. Loading native bindings triggers additional class loads (`YogaConfig` / `YogaNode`), and can lead to problems in multi-dex scenarions. Reviewed By: pasqualeanatriello Differential Revision: D14560658 fbshipit-source-id: 14e31e3c3b560675b5a752a38ae75ab80a565ea1
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
/**
|
|
* 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.
|
|
*/
|
|
#include <fb/fbjni.h>
|
|
#include <yoga/YGValue.h>
|
|
|
|
struct JYogaNode : public facebook::jni::JavaClass<JYogaNode> {
|
|
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaNodeJNIBase;";
|
|
|
|
jfloat baseline(jfloat width, jfloat height);
|
|
jlong measure(jfloat width, jint widthMode, jfloat height, jint heightMode);
|
|
};
|
|
|
|
struct JYogaLogLevel : public facebook::jni::JavaClass<JYogaLogLevel> {
|
|
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogLevel;";
|
|
|
|
static facebook::jni::local_ref<JYogaLogLevel> fromInt(jint);
|
|
};
|
|
|
|
struct JYogaLogger : public facebook::jni::JavaClass<JYogaLogger> {
|
|
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogger";
|
|
|
|
void log(
|
|
facebook::jni::alias_ref<JYogaNode>,
|
|
facebook::jni::alias_ref<JYogaLogLevel>,
|
|
jstring);
|
|
};
|
|
|
|
struct JYogaValue : public facebook::jni::JavaClass<JYogaValue> {
|
|
constexpr static auto kJavaDescriptor = "Lcom/facebook/yoga/YogaValue;";
|
|
|
|
static facebook::jni::local_ref<javaobject> create(YGValue value) {
|
|
return newInstance(value.value, static_cast<int>(value.unit));
|
|
}
|
|
};
|