Remove uses of UsesNativeCallProxy and UsesGeckoThreadProxy, now that
they are not needed.
Remove cases where we had to invoke a call in a proxy, because the call
is now specified to be invoked directly in the WrapForJNI annotation,
without the need to go through the proxy.
For SmsManager and AlarmReceiver, we no longer need to manually dispatch
everything to the Gecko thread because that's now handled automatically.
PrefsHelper uses Maybe<> as a replacement for a ternary expression, in
order to work around jni::StringParam's lack of copy constructor.
However, we can add a move constructor to StringParam, which lets us use
it in a ternary expression, and avoid the awkwardness of Maybe<>.
PrefsHelper uses Maybe<> as a replacement for a ternary expression, in
order to work around jni::StringParam's lack of copy constructor.
However, we can add a move constructor to StringParam, which lets us use
it in a ternary expression, and avoid the awkwardness of Maybe<>.
In an expression such as:
const auto& x = cond() ? AClass(...) : AClass();
the C++ standard specifies that the copy constructor of AClass is
invoked on the result of the conditional expression ([expr.cond]p6).
GCC does not honor this part of the specification, whereas clang does;
clang therefore complains about instances of code such as:
const auto& jstrVal = type == widget::PrefsHelper::PREF_STRING ?
jni::StringParam(strVal, aPrefName.Env()) :
jni::StringParam(nullptr);
as jni::StringParam is not copy-constructable.
The simplest solution that does not introduce unnecessary allocation
uses mozilla::Maybe to hold the temporary objects and to hide some of
the details of constructing objects in-place. The compiler may even be
able to optimize away some of the unnnecessary checks that Maybe
introduces (e.g. checking for whether the Maybe is a Some or None at
certain points).
Implement the PrefsHelper native methods. The previous browser.js
implementation supported "pseudo-prefs" that did not exist as actual
prefs, but was accessible through PrefsHelper. In order to accommodate
these pseudo-prefs, we send observer notifications in order to
communicate with browser.js about prefs that we don't support.
This patch adds specializations of jni::Ref for primitive arrays like
IntArray and FloatArray, so that the arrays can be accessed through the
GetElement, GetElements, and Length members.
When getting nsAppShell from another thread, there could be a race with
nsAppShell being destroyed on the main thread. This patch makes the raw
nsAppShell pointer only accessible from the main thread, and use a
static mutex to coordinate accessing nsAppShell from other threads.