This patch adds a specialization for jni::Ref<jni::ObjectArray>, which
includes members for getting the length of the array and accessing
array elements.
This patch adds a specialization for jni::Ref<jni::ObjectArray>, which
includes members for getting the length of the array and accessing
array elements.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.
--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
If a C++ class implements native calls that all return void, it can
choose to have those calls go through a custom proxy function by
inheriting from mozilla::jni::UsesNativeCallProxy and override the
ProxyNativeCall member.
ProxyNativeCall accepts a rvalue reference to a
functor object specific to each call, and can alter the calling
environment (e.g. dispatch the call to another thread) before issuing
the actual native call through the functor's operator().
Any JNI refs contained in the call are automatically turned into global
refs so that the call can continue to work outside of the original JNI
call.
Native call proxy will be used to implement automatic dispatching of
native calls from the main thread to run on the Gecko thread.
This patch fixes a compile error when using WeakPtr, where Impl* was
expected but SupportsWeakPtr<Impl>* was given.
This patch also fixes a compile error when using the DisposeNative
implementation provided by the autogenerated Natives class. e.g.,
> struct Foo : Bar::Natives<Foo> {
> using Bar::Natives<Foo>::DisposeNative;
> };
This uses a default implementation of DisposeNative instead of a custom
implementation, and resulted in a compile error that this patch fixes.
The mangled name of a NativeStubImpl instantiation is longer than
necessary because of the ReturnType arg. This patch turns it into a bool
parameter. It also reorders the parameters for cleanness.
Add more constructors in LocalRef and GlobalRef to accommodate use cases
where a JNIEnv is already available for performance reasons. Also add
more null-checks when creating references for performance reasons.
clang doesn't like it when we declare things as a struct in one place
and a class in another. This change makes all the current usages
consistent and clang happy.
Add a direct ownership model where the Java object owns the
corresponding C++ object directly, in addition to the WeakPtr model
where the Java object owns a WeakPtr to the C++ object. The WeakPtr
model is chosen when the implementing C++ class inherits from
SupportsWeakPtr. Otherwise, the direct ownership model is chosen. Under
the direct ownership model, a UniquePtr object must be used to attach
the containing C++ object to a Java object, to ensure ownership is
passed on to the Java object.
This patch adds:
* Conversion operator from String::Param to String::LocalRef.
* More overloads of the jni::ThrowException function.
* name members to built-in types like jni::Object, jni::String, etc.
This allows using jni::Accessors::EnsureClassRef on built-in types
to get built-in class refs (e.g. jclass for java/lang/String).
* Ability to implicitly convert LocalRef<Cls> to LocalRef<Object>
* Fixes for bugs in LocalRef/GlobalRef where new refs are not created.
* Fixes for inaccurate uses of mozilla::Forward in favor of mozilla::Move
We use Ref::From() inside TypeAdapter<Ref>::ToNative to convert a raw JNI
ref argument to a Ref argument for the C++ function. However, that
generates a compile error, unless we make TypeAdapter<Ref> a friend of
Ref, because we intentionally made Ref's copy constructor private and
returning from TypeAdapter<Ref>::ToNative requires the copy constructor.
Introduce a JNIObject class that serves as a base class for classes
that wish to use per-instance native methods. JNIObject includes a long
native pointer field that the C++ code accesses to associate the Java
object instance with a C++ object instance.