Originally, the GeckoThread PROFILE_READY state was chosen to correspond
to the profile-do-change event, to give priority to JNI code (e.g.
window creation) over other events that may be registered under
profile-after-change event. However, this leads to broken tests because
our testing infra expects things like window creation to happen during
profile-after-change at the earliest. This is because we have to wait
for addons like SpecialPowers to be loaded between profile-do-change and
profile-after-change. This patch changes the PROFILE_READY state to
correspond to the profile-after-change event, so things are consistent
again.
A C++ class that implments native JNI methods can choose to inherit
UsesGeckoThreadProxy. Once enabled, all native JNI calls on that class
will be automatically dispatched to the Gecko thread as a runnable event.
nsWindow will implement native methods of GeckoView.Window. This patch
implements the open method, which opens a new window in the same manner
as the CLH, and associates the new nsWindow with the GeckoView.Window
instance.
GeckoView.Window is a class that acts as the interface between
GeckoView in Java and nsWindow in C++. It will contain native methods
that GeckoView will use to interact with nsWindow.
On initialization, Window.open is called to create a nsWindow and
establish the JNI association between Window and the native nsWindow.
Then, whenever Window instance methods are called, the JNI stubs will
automatically call members of nsWindow.
With the new nsAppShell event loop based on runnable events, we need to
implement AndroidGeckoEvent handling as a runnable event. This patch adds
nsAppShell::LegacyGeckoEvent and adopts its implementation from existing
code that handle AndroidGeckoEvent.
nsAppShell is currently based on AndroidGeckoEvent objects, which mirror
GeckoEvent on the Java side. With GeckoEvent going away, we will be
gradually removing AndroidGeckoEvent as well. This patch makes the
nsAppShell event loop based on runnable objects, which derive from
nsAppShell::Event. Using runnable objects is much more flexible and allows
us, for example, to post a lambda to the event loop to be run later.
Gecko on Android follows the Android app model where it never stops
until it is killed by the system or told explicitly to quit. Therefore,
we should exit Gecko when there is no window or the last window is closed.
Warnings fixed include the following.
- Several cases where macros (|LOG| and |ALOGE|) were redefined. I just did a
simple #undef to fix these.
- In GonkMemoryPressureMonitoring.cpp, "the address of NuwaMarkCurrentThread
will never be NULL".
- In OrientationObserver.cpp, several signed/unsigned comparison warnings.
- Several warnings about variables that are unused or set but not used:
in InputDispatcher.cpp, InputReader.cpp.
Also in SpriteController, where several loops were all but empty if
HAVE_ANDROID_OS is undefined; for these I moved the HAVE_ANDROID_OS check
outside the loop.
The patch also disallows the introduction of new warnings by removing the
ALLOW_COMPILER_WARNINGS flag.