external/android-jni-wrap: Upgrade base header for new features

This commit is contained in:
Ryan Pavlik 2020-10-28 12:05:28 -05:00
parent fc78b5de86
commit 0325409210

View file

@ -143,9 +143,17 @@ class MetaBase {
* *
* @param classname The class name, fully qualified, with namespaces * @param classname The class name, fully qualified, with namespaces
* delimited by `/`. * delimited by `/`.
* @param clazz The jclass object for the class in question, if known.
*/ */
explicit MetaBase(const char *classname) explicit MetaBase(const char *classname, jni::jclass clazz = nullptr)
: classname_(classname), clazz_(classname_) {} : classname_(classname), clazz_() {
if (clazz != nullptr) {
// The 0 makes it a global ref.
clazz_ = jni::Class{clazz, 0};
} else {
clazz_ = jni::Class{classname};
}
}
private: private:
const char *classname_; const char *classname_;
@ -192,9 +200,18 @@ class MetaBaseDroppable {
* *
* @param classname The class name, fully qualified, with namespaces * @param classname The class name, fully qualified, with namespaces
* delimited by `/`. * delimited by `/`.
* @param clazz The jclass object for the class in question, if known.
*/ */
explicit MetaBaseDroppable(const char *classname) explicit MetaBaseDroppable(const char *classname,
: classname_(classname), clazz_(classname_) {} jni::jclass clazz = nullptr)
: classname_(classname), clazz_() {
if (clazz != nullptr) {
// The 0 makes it a global ref.
clazz_ = jni::Class{clazz, 0};
} else {
clazz_ = jni::Class{classname};
}
}
/*! /*!
* Gets a reference to the class object, but is non-null only if it's still * Gets a reference to the class object, but is non-null only if it's still